Question

I've been doing .NET and C# programming for quite some time, but this is my first attempt at doing anything web-based with it. I need to call a SOAP web service, which I know the URL for, and call methods of that service. I've set it up as a "Web Reference" in my project, however, I'm now not sure how to call methods of the service. I've been Googling this for the past hour trying to figure out what I need to do, but based on the results I'm seeing, this is a hard/convoluted thing to do (and I know it's not really)!

Can anyone please show me some straight-forward sample code for calling methods on some generic web service that you've got set up as a Web Reference OR point me to a decent tutorial that does? I think, given my experience of using C# and .Net in the past, this project won't be an issue once I can figure this one part out...

Thanks in advance!

Was it helpful?

Solution

When you added the web reference successfully Visual Studio generated a bunch of code that wraps the types and methods exposed by the service. Look at those files to figure out which namespace they're under, and the name of the actual service proxy class. Once you import the namespace it's just a matter of creating an instance of the proxy and calling its methods.

OTHER TIPS

You will call the web services methods just like calling any object method. Because .net framework created all required classes for you. When adding web reference VS IDE asks for a name, this name is the root namespace to access related method names.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top