Geeks With Blogs

News View Michael Stephenson's profile on BizTalk Blog Doc View Michael Stephenson's profile on LinkedIn
Michael Stephenson keeping your feet on premise while your heads in the cloud

Article Source:

Recently at the UK SOA/BPM User Group Yossi Dahan and I chatted briefly about using MsBuild and BizTalk, more specifically Yossi mentioned that he wished it was possible to regenerate the schemas for consuming a service automatically.

Following this discussion and a few other things I had a blast at seeing how difficult this would be to do. I think there is a lot of value in having this approach as it fits well with a contract based development approach and continuous integration. I want to be able to regenerate my schemas every time I build the solution, and if a breaking change has been introduced I want the solution to break so it is corrected.

This fits with what I believe is a good practice to identify these kinds of problems as early as possible in the development cycle.

The aims of the task are:

  1. Act in a similar way to the Generate Schema feature for BizTalk/Visual Studio except that it will be driven by an MsBuild task rather than a GUI
  2. Just deal with the schemas, I wasn't too bothered about regenerating the orchestration and binding file samples

(The sample is available for download at the bottom of the article)

The Sample

In the sample the quickest way to demonstrate this is as follows:

  1. Modify the BuildProcess.xml file to point to your url for the MexEndpoint
  2. Double click the RunBuild.cmd file
  3. Check the Acme.BizTalk.Schemas.WCFService folder and you should see your schemas have been updated

It is expected that you would include the schemas in your project, but exclude them from source control so they can be rebuild every time you build the solution.

Digging Deeper

I managed to work out how to do this by inspecting the Microsoft.BizTalk.Adapter.Wcf.Consuming with Reflector. Upon investigation it would have been nice if a few of the classes were externally available from the component. As it was I needed to disassemble the component to progress this idea. In the disassembled component I created a new version of the Consumer class in which I removed some of the functionality and changed the Consume method interface so it wasn't dependant on being passed a Visual Studio Project object.

With a couple of other tweaks I was able to get this working


Although this task seems to do the job, it has not been extensively tested, and it also only currently works with the MEXEndpoint and not yet with meta data files.

Hopefully this idea will help a few people, and the idea might get back to the product team as a possible future enhancement as this kind of thing can certainly help your development process be more effective.

Posted on Tuesday, July 29, 2008 1:16 AM BizTalk , MsBuild | Back to top

Comments on this post: MsBuild Task for consuming WCF Services

# re: MsBuild Task for consuming WCF Services
Requesting Gravatar...
Hi Michael, great article . This was one thing I've been hunting for ages . The sample produces the schema's perfectly . Is there a way I can get the bindings too . The Consuming Wizard in essense creates the Schemas and the Bindings isnt it.

Left by Suresh Gladstone on Sep 30, 2010 5:47 PM

# re: MsBuild Task for consuming WCF Services
Requesting Gravatar...
Mobdro is another video-streaming or mobile tv software download system for those people. It's wise for viewing television stations like ESPN, TNT, along with also others. It's greater than 200 television channels. The portion of working with that really is the fact that free of charge it's possible to utilize it to get a life and yearly to get this or you've got to provide a charge should you would like to use some superior options also watch live tv on smart tv free
Left by wadfre on Oct 26, 2017 8:48 PM

Your comment:
 (will show your gravatar)

Copyright © Michael Stephenson | Powered by: