How to generate WSDL files during build time?

Discussion in 'ASP .Net Web Services' started by Prasanna Padmanabhan, Jul 15, 2004.

  1. Hi,

    We have a web serivce in our build system. There are 2 clients for the web
    service. We would like to automatically genrate the wsdl file and the client
    proxies during build time, so that, if the interfaces changed at any time,
    we come to know about it during build time (build would break) rather than
    during run time. I know how to generate the client proxy from the WSDL file
    using WSDL.exe. But how do I generate the WSDL file itself during compile
    time?

    Please help.

    Thanks,
    Prasanna Padmanabhan
    Prasanna Padmanabhan, Jul 15, 2004
    #1
    1. Advertising

  2. The only way to do this is to run the ASMX through ASP.NET.

    There are 2 approaches. One is to actually deploy the ASMX file into a
    running IIS with ASP.NET installed, then just httpget the URL for thew WSDL,
    eg
    http://yourserver/vroot/Service1.asmx?WSDL

    To get the WSDL in a build, you can use any command-line httpgetter utility,
    even something as simple as this javascript:

    // getWSDL.js a simple command-line WSDL getter.
    // Call it like this:
    // cscript getwsdl.js <url>
    //
    // output goes to stdout.
    //

    var XMLDoc, XSLDoc ;
    XMLDoc = WScript.CreateObject("MSXML2.DOMDocument") ;
    XMLDoc.async= false;
    XMLDoc.load(WScript.Arguments(0)); // exception here if the ASMX does not
    compile successfully. The result is not XML, it is HTML !!
    WScript.Echo(XMLDoc.xml);
    WScript.Echo("");


    Option 2 is to build a utility to host ASP.NET, and compile the ASMX, and
    produce the WSDL. In this case you wouldn't need IIS, but you'd need to
    build this util yourself. This is attractive, because you do not need to
    deploy to IIS. However, the catch is that since you are not deploying to
    your server, you have to be concerned about the availability of libraries
    that may be referenced by the ASMX.

    Search for articles on "hosting the ASP.NET runtime" to explore this.
    eg,
    http://www.neward.net/ted/Papers/HostingASPNET/HostingASPNET.html

    Here is an simplistic example console utility that hosts the ASP.NET
    runtime, compiles an ASMX and produces the WSDL on the console.
    http://www.winisp.net/cheeso/srcview.aspx?file=asmx2wsdl.cs

    Cassini is an example of a pre-built server that hosts ASP.NET (and source
    code is available). Using a server might be more attractive because the
    startup time of an ASP.NET host is significant. A server that runs
    continuously only incurs this cost once (at startup). A command line util
    that hosts ASP.NET must incur the cost with every invocation.

    Using Cassini to produce WSDL from ASMX is very much like using IIS to do
    the same, except, it is not the full IIS. This may be a good thing or a bad
    thing depending on your requirements.

    Find more about cassini on
    http://www.asp.net/Projects/Cassini/Download/Default.aspx?tabindex=0&tabid=1

    -Dino


    "Prasanna Padmanabhan" <> wrote in message
    news:...
    > Hi,
    >
    > We have a web serivce in our build system. There are 2 clients for the web
    > service. We would like to automatically genrate the wsdl file and the

    client
    > proxies during build time, so that, if the interfaces changed at any time,
    > we come to know about it during build time (build would break) rather than
    > during run time. I know how to generate the client proxy from the WSDL

    file
    > using WSDL.exe. But how do I generate the WSDL file itself during compile
    > time?
    >
    > Please help.
    >
    > Thanks,
    > Prasanna Padmanabhan
    >
    >
    Dino Chiesa [Microsoft], Jul 17, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dark
    Replies:
    1
    Views:
    4,624
    milfar
    Nov 14, 2008
  2. Chris Bedford
    Replies:
    0
    Views:
    577
    Chris Bedford
    Aug 21, 2003
  3. Stephen Edgecombe

    WSDL.EXE: WSDL Import Directive

    Stephen Edgecombe, Aug 13, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    237
    Stephen Edgecombe
    Aug 13, 2003
  4. RH
    Replies:
    1
    Views:
    260
    Dino Chiesa [Microsoft]
    May 27, 2004
  5. Generate verbose WSDL from WSDL with imports

    , Apr 26, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    207
Loading...

Share This Page