15

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#?

ASh
  • 32,398
  • 9
  • 53
  • 74
Jason94
  • 12,922
  • 36
  • 102
  • 179

5 Answers5

22

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

thelost
  • 6,488
  • 3
  • 26
  • 43
9

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.

alimbada
  • 1,372
  • 1
  • 11
  • 27
4

If your preferred approach is to control the generated code, it's best to use the more recent SvcUtil.exe in place of Wsdl.exe.

See also WCF proxy generation: svcutil.exe vs wsdl.exe

Eric Boumendil
  • 2,238
  • 1
  • 27
  • 32
3

Adding web service reference to your project n making a call to the service exposed methods is your best bet . It does the trick n you're out of the hassle of creating SOAPs manually

Andro Selva
  • 53,136
  • 52
  • 190
  • 238
Amrit
  • 31
  • 1
2

You can use the "wsdl.exe" command from the .NET SDK to generate the wrapper classes if you don't want or like to use Visual Studio.

see: http://msdn.microsoft.com/en-us/library/7h3ystb6%28VS.80%29.aspx