Sending Soap with Attachments (SwA) using BizTalk – Part 1

This is a continuation to my previous article. Please have a look if you hadn’t seen it.

Sending Soap with Attachments (SwA) using BizTalk

Below are the steps that we have to follow for this exercise.

1. Create a custom message encoder which can send XML as an attachment in the SOAP envelope message.

2. Create a WCF service which can send the SOAP message with attachment.

3. Create the BizTalk application which can consume the custom WCF service.

Steps are easy isn’t. In this post we will only cover Step 1.

As I have told in the previous post, this custom encoder has been developed by Austrin interoperablity council and they have published the code in Codeplex. I have taken this code and removed some hard coded stuff and placed it in configurable properties.

I have uploaded the full source code below.

http://code.msdn.microsoft.com/Send-Soap-with-Attachments-3784e5f6

Shankar

Sending Soap with Attachments (SwA) using BizTalk

Soap With attachments is a very old technique and is still used in lot of legacy systems. More new technologies has emerged like MTOM which is widely used within the WCF arena. That said, there is no out of the box support within WCF to send a SOAP message with attachments.

An Austrian Microsoft Interoperability Council had a challenge to consume a webservice which expects to send a SOAP message with attachments.

http://blogs.msdn.com/b/mszcool/archive/2009/10/19/windows-communication-foundation-and-soap-with-attachments-message-encoder-built-in-interop-lab-with-svc-sozialversicherungs-chipkarten-betriebs-und-errichtungsgesellschaft-m-b-h.aspx

They have developed a custom encoder which can add the zip message as an attachment in the outgoinh SOAP envelope.

However I had a different challenge in consuming a webservice which requires me to send a soap payload which has an XML attachment. So I had to modify the custom encoder in such a way that I can attach a XML document. I had lot more challenges. The webservice which I had to consume was written in Java and the field appears as xsd:hexBinary in the WSDL file. So there is no way I can add a service reference / web reference to my project. I did tried that, but when I tried to send the message, the server was rejecting the message. The reason for this is Visual studio when generating the client code for the service, puts the type as xsd:base64binary.

So, I had to code the datacontracts, messagecontracts and servicecontracts based on the WSDL. Then I plugged in the code to use the encoder to attach the XML message. There is no direct way to do this from BizTalk. I wrote this entire logic in a WCF Service which acts as a client to the Target web service and acts as a Server for BizTalk. BizTalk application will consume this WCF service and send the SOAP message with attachment.

I am going to present an article with walkthrough in the next post.

Shankar

My contribution(BizTalk custom pipeline components) in technet website

I am happy to see that my contribution – BizTalk custom pipeline component has made it to list.

http://social.technet.microsoft.com/wiki/contents/articles/11679.biztalk-list-of-custom-pipeline-components-en-us.aspx

My component is listed in the Transformation section

Mapper Pipeline Component

This gave me an idea of developing the tranform concept in a pipeline component, wherein you don’t have to actually create a map for transforming the message.

http://www.codeproject.com/Articles/19228/Mapper-Pipeline-Component

Shankar

Build and Deploy Manager using BTDF

Fancy a build and deploy manager for BizTalk which uses BTDF in the background?

We use BTDF for building the BizTalk projects and most people now would have used TFS to do continuous integration which can utilize BTDF do build and deploy the projects.

However this is perfectly fine for automating the continuous integration process. When BizTalk projects has to be moved from development to test and production environments, manual installation steps are followed by deployment teams. For companies having a large number of projects and having the headache of following with the deployment team for the list of projects and release notes is inevitable. It sometimes require people from the dev team to sit with the deployment team to deploy the BizTalk applications.

I have developed a tool to assist with this issue. I have just started off with that tool. I will be constantly updating this tool to make it more generic.

Tool Background
Ideally this tool can be used by a build and release manager who can prepare the BizTalk MSI and deploy the applications in the respective environment without any BizTalk or BTDF knowledge

I have uploaded the project in codeplex. Its open source. So if you have any thoughts, pls share … shankar.sekar@gmail.com

http://buildanddeploybtdf.codeplex.com/

Thanks
Shankar