Home  /  Questions  /  Question

108   96.7
Aug 12, 2011


I created a web service and published it to a server. Not I want to call the method in the service. How do I instatiate a ActionServiceClient? When I put the URL in a browser it says:
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax

svcutil.exe http://myserviceloaction.svc?wsdl 

And in my code I want or need to instatiate a client like: 

ActionServiceClient client = new ActionServiceClient();

In the example they included a method:


code here...


I don't want the method plus the method doesn't work because the code isn't seeing ActionServiceClient.

Any ideas??


protected ActionServiceClient Client

588   99.9
Sep 08, 2011
Dennis, you're not really instantiating the ActionServiceClient in as much as it is being generated automatically when you create a service reference to the service.  So I think that is the step you are missing.

There are fairly complex ways to manually modify the web.config to contain all the necessary configuration to communicate with the service, but Visual Studio does this for you.

Just right click on your References folder in your web application, then select the Service Reference then select your service.  If you built your WCF service correctly it will appear in the dialog and you can select it.  When you click OK, VS generates all the code to communicate to the service.

Then you can make a reference to the proxy client.

You should analyze the Patterns In Action application a little more closely for more information on how this is done.

I hope this helps.