Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a SOAP/WSDL client in C#?

Tags:

c#

soap

wsdl

I have been playing around in PHP with it and got something to work, what i did was:

$client = new SoapClient("http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl");
$fetchedArr = $client->GetCityForecastByZIP(array("ZIP" => "10451")); //get the weather in the bronx YO!

And now i would like my application i WPF/C# to do the same. What is the equivalent in c#?

like image 570
Jason94 Avatar asked May 05 '10 11:05

Jason94


People also ask

What is WSDL client?

WSDL is an XML notation for describing a web service. A WSDL definition tells a client how to compose a web service request and describes the interface that is provided by the web service provider.

How do I create a web service out of WSDL?

In Visual Studio, create or open an Enterprise Server Application project that contains a WSDL file that describes a COBOL application. In the Solution Explorer, right-click the WSDL file; then select Generate Web Service from the context menu.


2 Answers

The simplest way is to use VS and add a web reference. This automatically creates the stub for you

like image 100
thelost Avatar answered Sep 28 '22 01:09

thelost


You can use the WSDL tool to generate a C# file which will contain the necessary types and members to talk to the web service or you could add a Web Service reference. See here for more details.

like image 43
alimbada Avatar answered Sep 28 '22 00:09

alimbada