Following on from my previous blog this will discuss the same topic in the context of the WSE 2 adapter.
Problem
Again i wanted to be regenerating the web services published by the WSE 2 adapter as part of my automated build. I wanted to use the same technique where possible, i.e manually publish the first time or when ever there was a significant change. I would then include the description file for the web services in my solution and then regenerate them using the custom msbuild task.
My aim was the have a task with the signature:
<WseWebServiceGenerator WebServiceDescription="C:\Description.xml"/>
Solution
This wasnt quite as easy as it sounded, i wanted to use the following code snippet (referencing the assemblies that come with the WSE 2 adapter):
using Microsoft.BizTalk.WseWebServices;
using Microsoft.BizTalk.WseWebServices.Description;
WebServiceDescription desc = WebServiceDescription.LoadXml(this._Path);
WebServiceBuilder builder = new WebServiceBuilder();
builder.WebServiceDescription = desc;
builder.BuildWebService();
This was basically the same as for the soap adapter but referencing the WSE 2 assemblies.
The major problem i had was there was a bug in the WSE 2 assemblies. The bug was that when it deserializes the description file if you have not chosed kerberos authentication a null or empty string is passed to this property on the object. In the code if this value is passe then it throws an error. To solve this i had to do a bit of hacking so i disassembled the assemblies and fixed the bug and rebuilt them to base my msbuild task on them.
Hopefully this bug will be fixed in course by microsoft, but until then you can probably just use this work around if you need to