How to generate the client from a WSDL file in .net?

六眼飞鱼酱① 提交于 2019-12-12 14:17:02

问题


I'm trying to generate a client from a WSDL file without using visual studio itself and didn't know what the best place was to start.

A customer needs to take this same file and generate a client for a PHP application and I wanted to prove the WSDL was valid by creating a client myself (outside of studio).


回答1:


svcutil.exe is a commandline tool that comes with the Windows SDK. It creates a WCF client (C# code file plus configuration file, the elements of which can be placed in your web.config or app.config).

I'm fairly sure you can pass a UNC path to a WSDL rather than a URL.




回答2:


wsdl.exe is your freind.

Update after comment - is this what you mean?

wsdl /out:[localpath]/myProxyClass.cs http://localhost/WebserviceRoot/WebServiceName.asmx?WSDL



回答3:


To take a WSDL to a code module use:

wsdl /n:<Namespace> pathtowsdlfile

Then we want to compile the dll with debug symbols, and a given filename.

Use:

csc /t:library /debug /out:<DllFileName.dll> pathtosourcefile.cs



来源:https://stackoverflow.com/questions/1573202/how-to-generate-the-client-from-a-wsdl-file-in-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!