Simon Fell > Its just code > A WSDL Client for Radio ?
Friday, February 8, 2002
WSDL FM ( aka Radio WSDL )
In Sam's article Axis/Radio interop, actual and potential, he describes calling Radio hosted services from Axis, and calling Axis hosted services from Radio, then goes on to describe how WSDL can remove some of the grungyness of making the SOAP call. Finally he leaves us with a teaser of what could be.
There's a middle ground not mentioned, which is to generate the macro files from WSDL and drop them in the Macros directory, not quite as easy to use as Sam's teaser, but pretty close. A quick test reveals that you can create a directory structure under the Macros tree, and reference them will the . notation, e.g. create a directory foo under macro's, and drop bar.txt in there, can you can call <% foo.bar() %>. Looks promising :)
So, inspired by Sam's teaser, I set out to write a tool that generates Radio macro's from WSDL. Now correctly parsing and processing WSDL is a PIA, however our friends up in the north have conviently done most of the work, there's a pretty good WSDL parser built into the .NET Framework, thanks Keith !.
With most of the WSDL gunging out of the way, its a pretty straightforward task to walk around the WSDL and spit out text files for each operation. The tool generates the macros into a sub directory, named after the Port, so in the case of the 4s4c Interop service, you get a interopTestPort directory, with files for each method, echoString, echoInteger, echoDate etc. Simply copy the directory under the Macros directory, and off you go, making calls is now as simpe as <% interopTestPort.echoString("Hello Dave !") %>
You can download the source code and executable from here. Run the tool with radio_wsdl http://some/wsdl/document
You can see the results of a little test with the macro's generated from 4s4c and the Delphi servers.
Issues:
There's a known issue with the .NET WSDL parser, in that it needs the WSDL and/or XSD documents to be served with a text/xml content-type, however many WSDL docs that are served as static content typically get a application/ocectstream content type. And unfortuantly, the interop docs on whitemesa.com fall into this category, so i couldn't test with the Axis WSDL doc :(