Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Dear All,

i have a web service on remote server format "service?WSDL" and i want to consume it in C# application, please any one can help me how i can access the web service from my application
Posted

If you're using visual studio, you can right click on the project, select "Add a Service Reference..." On the dialog that pops up, then you click the "Advanced" box and choose "Add a Web Service Reference"

In there you enter the url to the service?WSDL and it will allow you to specify a namespace in the right hand side, and display all of the discovered methods on the left. Lets say you added the namespace as "foobar" and your target service is called MyService.

After you complete the add, you can then call the service like this:

C#
using(var svc = new foobar.MySerivce()){

  var result = svc.SomeMethodOfTheService(withAParameter);

}


If you are NOT using visual studio, then you'll have to generate the proxy on the command line using WSDL.exe.

Here's an example of using the command line tools: http://gsraj.tripod.com/dotnet/webservices/webservice_csharp_client.html[^]
 
Share this answer
 
Comments
biloo_1983 23-Jul-12 9:39am    
thank you, i am familiar with web services and WCF and has more of 2 years experience in this domain, but now i have new parameter thtat the web service not developed by mine and i want consume web service form client just to work with some APIs, i think i need the name of end point in this service because it gave me an error that to specific the endpoint name to connect with.
dave.dolan 23-Jul-12 9:42am    
This is the procedure for all WSDL web services, not just the ones you write, nor the ones that are .NET in origin. WSDL is a standard. What is your specific error?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900