Geeks With Blogs

News This is the *old* blog. The new one is at blog.sixeyed.com
Elton Stoneman
This is the *old* blog. The new one is at blog.sixeyed.com

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 5, 2008 9:45 PM ESB Guidance , CodePlex Project , CodeGen | Back to top


Comments on this post: Contract-First CodeGen

# re: Contract-First CodeGen
Requesting Gravatar...
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.
Left by Sujesh on Jun 09, 2008 1:06 PM

# re: Contract-First CodeGen
Requesting Gravatar...
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?
Left by Elton on Jun 12, 2008 9:43 AM

# re: Contract-First CodeGen
Requesting Gravatar...
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.
Left by Sujesh on Jun 13, 2008 5:42 AM

# re: Contract-First CodeGen
Requesting Gravatar...
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.
Left by Elton on Jul 30, 2008 12:26 PM

# re: Contract-First CodeGen
Requesting Gravatar...
I had terrible problems with the WSDL structure, gave up in the end to be honest. grrrrrr..
Left by virtual pa on Jul 02, 2010 2:46 PM

# re: Contract-First CodeGen
Requesting Gravatar...
I have been searching this type of information from a long time and finally find it in this post .Good to all these things .Now I can refer to my friends.Thanks a lot for posting .
Left by Hohlkammerplatten on Oct 12, 2010 3:00 AM

# re: Contract-First CodeGen
Requesting Gravatar...
Is it easy to set up a hosting account the domain is from the different provider. pmp exam fee free pmp questions
Left by andy on Oct 31, 2011 1:34 AM

# re: Contract-First CodeGen
Requesting Gravatar...
Thanks for sharing such a useful information, will be checking out more from yours.
Left by vezbe za ruke on Jan 27, 2012 12:43 PM

# re: Contract-First CodeGen
Requesting Gravatar...
excel.This remedy contains a environmentally friendly anti-inflammatory which enables lessen the symptoms of temperamental besides ease furthermore stay hydrated. Worthy of critical weed surely in search of magical looking after in addition to the replacing.
Left by Lululemon Outlet on Apr 09, 2013 3:14 PM

# re: Contract-First CodeGen
Requesting Gravatar...
Sounds impressive, I'm fairly new to coding, well not exactly, new, but there are a number of different languages that I am good in. Computing is expansive, field with so many different sub-topics.
Left by Uchenna on May 01, 2014 1:06 PM

Your comment:
 (will show your gravatar)


Copyright © Elton Stoneman | Powered by: GeeksWithBlogs.net