Elton Stoneman

  Home  |   Contact  |   Syndication    |   Login
  82 Posts | 0 Stories | 116 Comments | 0 Trackbacks

News

Archives

Post Categories

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).

posted on Thursday, June 05, 2008 9:45 PM

Feedback

# re: Contract-First CodeGen 6/9/2008 1:06 PM Sujesh
Thanks for this tool. When I tried to call your ESB Sample WCF service, it throws exception. Did you face any issues?. The web service works fine.

# re: Contract-First CodeGen 6/12/2008 9:43 AM Elton
Hi Sujesh, I've tried it on a few machines without any problem from the Web or WCF service. What error message are you getting?

# re: Contract-First CodeGen 6/13/2008 5:42 AM Sujesh
Connection to WCF service through bus is working. But when i used your tool to access wcf service wsdl, it is giving me error "Unable to import binding...". It works well for web service. The reason I think is because web service wsdl is a flattened one and wcf service is a layered(it actually points to a http location of schemas). I did some hacking to get it working with wcf wsdl. Then web service stopped working. So basically now i am using two versions of your tool to access web service and wcf service wsdl. I can send you the code if you want.

# re: Contract-First CodeGen 7/30/2008 12:26 PM Elton
You're right about the structure of the WSDL causing problems Sujesh. Another option is to amend the WCF service to return a flat WSDL (see http://geekswithblogs.net/EltonStoneman/archive/2008/07/30/flattening-wsdl-from-wcf-services.aspx), which means the same tool can be used for WCF and Web services.

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: