Thursday, August 20, 2009

Soap Envelope Senario and Soap envelope on Part of MIME Document Response Options


Scenario:
We are doing a migration from Biztalk 2000 to Biztalk 2004.Previosly out Trading partner used to send an XML with Soap Envelope to an ASP file.The ASP used the Biztalk Interchange to Post to Biztalk2000.After Processing Biztalk sends back the response to the Trading Partner with the Soap Envelope.
I am trying to find out how its adding the Soap Envelope when its sending the response.
In the Migrated Scenario i am able to establish everything in the Response file except the SOAP Envelope.
i am not using the Biztalk interchange in the new Migrated Biztalk 2004.I am receiving the file in the ASP and dropping the file in the folder for Biztalk 2004 to pick it up from there.Biztalk 2004 picks up the file from the folder,process the file and then sends it to the Trading Partner.

Solution

---------------------------------------------------------------------------­---------------------------------------------
Use the BTF assembler in a send pipeline. You can add the same information that was used in earlier versions. I used the assembler when migrating a BT2002 project that used SOAP in the same manner you described.
---------------------------------------------------------------------------­----------------------------------------------

Scenario

I have to send a MIME Document response to the trading Partner.I have figured out everything except on how to add a soap envelope only to a part of the Multipart Mime response.When i was using the Biztalk FrameWork Assembler in my send pipeline to set the soap details it gives me this error
" '<', hexadecimal value 0x3C, is an invalid attribute character" Can anyone help me in pointing out what i am doing wrong.Can anyone tell me if i can use the Biztalk Framework Assembler in .net code and call it in orchestration.If i can do that how do i set the values and properties in .net.



Solution:
In my Example ,i receive a multipart mime and send out a multipart mime.The Multipart type i used was of Systm.XML.XMLDocument.
if i use the XML Document as the Multpart type for the Attachment part the encoding errors out because it is expecting a XML.
In order to resolve this problem ,Microsoft has a solution of creating a RawString Type.The RawString Type should be used for the multipart if the second part is PDF.
The code for creating a Raw String is below
using System; using System.IO; using System.Text; using System.Xml.Serialization; using System.Runtime.Serialization;
using Microsoft.XLANGs.BaseTypes;
namespace Microsoft.Samples.BizTalk.XlangCustomFormatters { public abstract class BaseFormatter : IFormatter { public virtual SerializationBinder Binder { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
public virtual StreamingContext Context { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
public virtual ISurrogateSelector SurrogateSelector { get { throw new NotSupportedException(); } set { throw new NotSupportedException(); } }
public abstract void Serialize( Stream stm, object obj ); public abstract object Deserialize( Stream stm ); }
public class RawStringFormatter : BaseFormatter { public override void Serialize(Stream s, object o) { RawString rs = (RawString)o; byte[] ba = rs.ToByteArray(); s.Write( ba, 0, ba.Length ); }
public override object Deserialize(Stream stm) { StreamReader sr = new StreamReader( stm, true ); string s = sr.ReadToEnd(); return new RawString( s ); } }
[CustomFormatter(typeof(RawStringFormatter))] [Serializable] public class RawString { [XmlIgnore] string _val;
public RawString(string s ) { if (null==s) throw new ArgumentNullException(); _val = s; }
public RawString() { }
public byte[] ToByteArray() { return Encoding.UTF8.GetBytes( _val ); }
public override string ToString() { return _val; } }
} Also at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_email_ibad.asp
Write this code in .Net and import the assembly in your Biztalk Solution.
You will now be able to set the Multipart PDF type to a raw string.
This solved my problem.

No comments: