BizTalk Server General - Scripting Web Service Publishing

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > June 2005 > Scripting Web Service Publishing





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Scripting Web Service Publishing
iturner100@gmail.com

2005-06-01, 7:47 am

Hi,

I've seen a couple of posts recently about the possibility of scripting
the publishing of web services, for example via Nant.

I had a need to do this on a recent project where the schemas that we
were publishing were not fully signed-off but we still needed to
publish them daily into our build environment.

Whilst this is not directly supported through the toolset, there is a
way of coercing it to happen - provided that you have used the Web
Service Publisher at least once.

Basically, the process is as follows:

1) Run the publisher against schemas or orchestration as normal
2) Grab the PublishingConfig.xml file that gets written to the temp
folder underneath the vroot that you published to
3) Use the following code to republish using the same config:

// Get the publishing config xml
PublishingConfig config = PublishingConfig.LoadXml(CONFIG_PATH);

// Create the publisher
Publisher publisher = new Publisher();

// Set the config via reflection
publisher.GetType().GetField("publishingConfig", BindingFlags.NonPublic
| BindingFlags.Instance).SetValue(publisher, config);
publisher.LoadBizTalkAssembly(ASSEMBLY_PATH);

// Publish
publisher.Publish();

4) Sit back and keep your fingers crossed...

In the above snippet, the CONFIG_PATH is where your master copy of the
PublishingConfig.xml lives and ASSEMBLY_PATH is the path to the
assembly you are working with (for schema-based publishing). I haven't
gone through it with an orchestration-based publishing as that isn't a
scenario we use - but it's probably along those lines.

The Publisher and PublishingConfig classes are in the
Microsoft.BizTalk.WebServices assembly so you'll need a reference to
that.

The publishingConfig member within the Publisher class is private so
you have to use reflection to hack your config in.

I haven't wrapped it as a Nant task but that's the next step. At the
moment i'm just using a command line exe to republish.

Give it a try, it's worked for me.

Cheers
Ian

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com