Consume Web Service with .Net
During the past 8 months, I have been playing with web services quite a bit – both calling and developing web services for my employer.Â However, I had some trouble along the way finding information on the different standards of web services (such as JAX-WS and JAX-RPC ), implementing those web services on the server (Jboss) , and testing the services by writing a web service client (VB.Net) .
So I thought documenting the information I have collected would be useful for others attempting the same thing.Â The next series of posts will show you how to write, deploy, and consume web services using a combination of .Net and Java.
Consume a Web Service in .NET
Calling a web service in Microsoft .Net framework is super easy.Â Simply open a new or existing project, click Project > Add Web Reference , then enter the URL to the web service’s WSDL .
A WSDL is an XML document that is used to define a web service , such as Method Names and Parameters for those Methods.Â Don’t worry, you usually don’t have to write this document by hand.Â Yes, the programming gods have smiled upon us.Â Most IDE editors will do this for you including Visual Studio and NetBeans .
After entering the URL as suggested above, just follow the wizard steps and .Net will take care of the rest for you.
Once complete, you should see Web References in the Solution Explorer pane in Visual Studio.Â You can edit the Reference Name and URL in the Properties pane by clicking on the web service reference (whatever you named it) under Web References .
Now you can reference the web service object that you just created by typing "WhateverYouNamedIt. "
Go ahead and give it a shot!
Join him as he learns and shares his experiences of marketing his own products online.
Subscribe via RSS