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
  • 34,632
  • 9
  • 60
  • 82
Jason94
  • 13,320
  • 37
  • 106
  • 184

5 Answers5

26

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

thelost
  • 6,638
  • 4
  • 28
  • 44
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,392
  • 1
  • 12
  • 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,318
  • 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,910
  • 52
  • 193
  • 240
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