Generate webservice from wsdl

后端 未结 4 2107
栀梦
栀梦 2020-12-17 17:38

This is maybe a really simple question, but I couldn\'t locate an answer:

For a client I need to HOST a webservice. The client has sent me a wsdl file that the webse

4条回答
  •  感情败类
    2020-12-17 18:14

    You can do plenty with that WSDL (wissd'le) file.

    From doing the WS Class manually to use the Auto Generated class from wsdl.exe

    let's imagine that, for your example, you have this WDSL (tooked from WebServiceX.Net)


    to create a C# auto generated proxy you go to your command prompt and write:

    wsdl /language:cs /protocol:soap /out:C:\myProxyScripts http://www.webservicex.net/TranslateService.asmx?wsdl
    

    Note: inside your C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin folder you will find wsdl.exe or just do a dir /s inside your C:\Program Files\

    if you want in Visual Basic, just use /language:vb or /l:vb

    /language: The language to use for the generated proxy class. Choose from 'CS', 'VB', 'JS', 'VJS', 'CPP' or provide a fully-qualified name for a class implementing System.CodeDom.Compiler.CodeDomProvider.

    The default language is 'CS' (CSharp). Short form is '/l:'.

    This command will put inside your C:\myProxyScripts the auto generated proxy.

    if your using the WSDL file in your computer, just change the URL to your full path, for example

    wsdl /language:cs /protocol:soap /out:C:\myProxyScripts C:\myProxyScripts\myWsdlFile.wsdl
    

    Note: your Generated proxy will be called the Service Name, the one you have specified, in our example, as:

    
    

    I hope this helps you, understand the WSDL, the Auto Generated Proxies and that you can manage now everything in your end to fulfill your client wishes.

提交回复
热议问题