I’m not sure why I’m having this problem, but I can only talk to my web service through a User Control or App.xaml.cs. I’m trying to use the service in a simple data oriented class so I didn’t want to use a User Control.
This compiles fine:
//App.xaml.cs
<using statements...>
namespace Sharepoint_Integration_Project
{
public partial class App : Application
{
private SharepointWS.SharepointWebServiceSoapClient SpWSSoap
= new SharepointWS.SharepointWebServiceSoapClient();
public App()
{
this.Startup += this.Application_Startup;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
....
This does not:
//Controller.cs
<using statements copied from App.xml.cs...>
namespace Sharepoint_Integration_Project
{
private SharepointWS.SharepointWebServiceSoapClient SpWSSoap
= new SharepointWS.SharepointWebServiceSoapClient();
public class Controller
{
}
}
Visual Studio reports “Expected class, delegate, enum…” for any reference to SharepointWS.SharepointWebServiceSoapClient.
I’m using the same steps listed here:
http://www.silverlightshow.net/items/Consuming-ASMX-Web-Services-with-Silverlight-2.aspx
My web service’s namespace is Sharepoint_Integration_Project.SharepointWS and I’ve tried fully qualifying it and that hasn’t helped.
Any suggestions are appreciated, thanks!
You have a field declaration outside of the class declaration. Can’t do that.
Change:
to: