简体   繁体   中英

How to generate proxy class from WSDL in case of webservice

suppose when i have only wsdl file then how can i create proxy class just to call webservice various method. how webservice related all class and its property & method will be exposed in my c# apps. can anyone help guiding me. thanks

You would need to use the ServiceModel Metadata Utility Tool , or Visual Studio's Add Service Reference Dialog in order to generate a client proxy for the service with which you want to communicate. The generated proxy will provide classes that abstract the service contract, and you can program your client applications to interact with these classes.

There is an utility, it shipps with Visual Studio (since 2005, I think), called wsdl.exe

It's commandline, and can be used to generate proxy.

You can use WSDL.exe tool using command line.

ie WseWsdl3 WSDLPath /out:MyProxyClass.cs

if WseWsdl3.exe is unable to create the proxy class, there is still a way.

If you can run your service as a regular ASP.NET web application in IIS, it creates temporary ASP.NET files where the proxy class is nicely generated for you.

You can find it in folder:

C:\\Windows\\Microsoft.NET\\Framework\\vMAJOR.MINOR.BUILD\\Temporary ASP.NET Files\\YOUR_WEB_APP. There are some subfolders with random names, go to most recent one and look something like "App_WebReferences.XXXX.0.cs".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM