Call a Web Service
I have connected to a Web service by adding it as a web reference, the wsdl an开发者_开发问答d xsd files are now visable, im using visual studio,
How can I get a response from the Web service, i.e. send some data and get an error message back.
Thanks for your time.
Once you add a web service reference, Visual Studio will generate a strongly typed client proxy class which you could instantiate and invoke the web method:
using (var proxy = new SomeClientProxy())
{
var result = proxy.SomeMethod("foo", "bar");
}
Just Create the object and use its method as you normally do with regular class objects
1- YourWebService obj = new YourWebService();
2- call methods on this object.
obj.YourWebServiceMethod();
精彩评论