Jon Flanders' Blog

More fun with the BizTalk Web Services Wizard code

Monday, February 28, 2005 8:00:00 AM (GMT Standard Time, UTC+00:00)

For a BizTalk project I am working on, we want to take an existing asmx Web Service and redirect the calls directly to BizTalk.  This Service has about 5 methods, so I need to create 5 orchestrations.  If I run the BizTalk Web Services Publishing Wizard on that assembly, each port becomes a seperate asmx file. Not what we want.

So I dug back into the code I had been working on a few months ago, and created a console application that takes a path to a BizTalk assembly, the name of the asmx file and the name of the virtual directory you want as the three arguments.  It runs the code from the Microsoft.BizTalk.WebServices assembly and takes all the webmethods from each of the 5 seperate asmx files that would be created and puts them all into one since asmx class.  It also allows me to control the name of the Web Service and asmx file created.


I could do this by hand by running the Web Services Publishing Wizard in Schema mode, but unfortunately there isn't any way to save the settings from a run of that Wizard to run it again, so as I change code, and if I want to do automated builds, I have to manually re-run the Wizard. Also not a solution I would have been happy with.

You can download the project here if you want it - BuildWebServiceTest.zip (20.99 KB)

I have some other ideas about what to do with the knowledge I've gained looking into these details that I'll be posting in the next few days.

BizTalk   #    Comments [3]   Tracked by:
"viagra" (viagra) [Trackback]

Wednesday, June 01, 2005 4:42:07 PM (GMT Daylight Time, UTC+01:00)
Thanks for sharing this -- I've been looking for a way to invoke the webservices publishing wizard programmatically. I skipped over the code which renames the web service since that's not part of my requirements. Each time I run this I'm getting the error "Invalid URI: The format of the URI could not be determined" after the "BuildWebService" call.

I may be passing in the 2nd & 3rd params incorrectly: the name of the asmx file and the name of the virtual directory. Does the asmx file have to be created first? Does the virtual directory have to be qualified (i.e. http://localhost/myDirectory or just myDirectory)?

I appreciate any & all help - AS
Wednesday, June 01, 2005 5:01:00 PM (GMT Daylight Time, UTC+01:00)
My sample is missing an important line of code (not sure how it got removed - but I am uploading a new version) - right after ce.Export - add this line (or just download the newly uploaded version)

config.ProjectSettings.ProjectPathname = "http://localhost/" + webname;

Thanks for finding that for me Adrienne
Friday, February 24, 2006 12:34:41 AM (GMT Standard Time, UTC+00:00)
How about if I want to call my Orchestration or solution from the Web Service. The thing is that I have a comple of solutions and I want to execute them from a Web Service. Can I do so?

Thanks in advance
All comments require the approval of the site owner before being displayed.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview