I've added some codegen scripts to the ESBSimpleSamples project, and a simple UI which runs the scripts against metadata it retrieves from a WSDL endpoint. The codegen templates were built for a custom tool which we use (not public I'm afraid), and then stripped down for the "ServiceClient.Generator" tool, so the structure might look a bit odd, but they do the following jobs:
- Extract the schema from the WSDL location to XSD (ready for loading into BizTalk)
- Build a (very) clean request DTO for the selected method
- Build a (similarly) clean response DTO for the selected method
- Build a typed ServiceRequest object for use with the ESBSimplseSamples.ServiceClient library, giving access to the service via ESB
The classes are just displayed in the form at the moment (using ScintillaNET for readability):
(if anyone has a burning desire to increase the functionality of the UI, let me know and I'll add you to the CodePlex project).
I'm intending to add further codegen scripts to generate:
- a unit test stub for calling the ServiceRequest
- a sample XML message containing the necessary itinerary steps in the header, and some dummy values in the body
- settings for adding the service to a UDDI repository.
This all works splendidly for the straightforward services I've tried so far, though I'm expecting some rework to deal with services that use types across a variety of schemas.
Rummaging around in the System.Web.Services.Description namespace to get the WSDL metadata really isn't much fun. I'll write a post moaning about it in more detail later, but for now I'll point to a couple of helpful resources: Web Service Studio Express (the basis for the DynamicProxy code) and C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\DefaultWsdlHelpGenerator.aspx (the page that ASP.Net runs when you enter a WSDL location in IE).