Re: Unparsed Interchange
- From: "Greg Forsythe" <greg.forsythe@xxxxxxxxx>
- Date: Wed, 22 Nov 2006 22:21:20 +1300
One of the things you need to do in your disassembler is to promote the
BTS.MessageType context property.
This is normally done by the Flat File Disassembler or XmlDisassembler.
Without the Message Type there is no matching schema for validation, the
message will not match the input message type of the map and will not match
the subscription filter on the orchestration.
Greg
"Armbruster, René" <ArmbrusterRen@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:06A06B4A-10A6-40D3-B67F-6986EAAF0948@xxxxxxxxxxxxxxxx
Hi Gary,
first of all thanks for your fast reply. I will try that tomorrow when I
am
back in office.
The answer if the message get´s created correctly and shown in HAT is:
yes.
But anything after that won´t work anymore (no xml validation, no mappings
and no orchestrations).
Thanks and regards.
René
"Gary" wrote:
Hi Rene,
This is a guess here, but have you tried setting your stream position
back
to zero after you call to GetOriginalDataStream, i.e. before you actually
use
it?
If that doesn't help, can you let us know if your message appears in HAT
as
expected in other words, has it been created correctly?
Gary
"Armbruster, René" wrote:
Hi NG,
I just developed a custom disassembler which is creating a new message
out
from the received one (flat recieved -> xml out with some new
parameters).
Now I got the problem that no mapping or orchestration works ... The
HAT
told me that it´s an "unparsed interchange" .... I read that it might
be a
problem with the stream(s) ...
Maybe someone could help me. Here is the code of my disassembler
method:
public void
Disassemble(Microsoft.BizTalk.Component.Interop.IPipelineContext pc,
Microsoft.BizTalk.Message.Interop.IBaseMessage inmsg)
{
Stream strmMessage;
IBaseMessagePart msgPart;
msgPart = inmsg.BodyPart;
// try to store the incoming message in strmMessage Stream
variable
try
{
strmMessage = msgPart.GetOriginalDataStream();
}
catch (Exception ex)
{
throw new ArgumentNullException(ex.Message);
}
// Get the original filename
string filename = inmsg.Context.Read("ReceivedFileName",
"http://schemas.microsoft.com/BizTalk/2003/file-properties").ToString();
// Split the returned filename so only the name of the file
is
stored
char[] splitter = new char[1];
splitter[0] = '\\';
int lastSplitterPos = filename.LastIndexOfAny(splitter);
filename = filename.Substring(lastSplitterPos + 1,
filename.Length - (lastSplitterPos + 1));
// Get the last row number for that filename. If not exists
set
rowNo to 0
int rowNo = getLastOracleRow(filename);
// Create a StringBuilder to create the xml message
StringBuilder sbOut = new StringBuilder();
// Create a StreamReader to read the incoming message
StreamReader strReader = new StreamReader(strmMessage);
string strRow;
// Write the beginning of the outgoing xml message
sbOut.Append("<ns0:Message
xmlns:ns0=\"http://seat.biztalk.schemas.OracleImport.OracleSchema\">");
// Read each row of the incoming message and store it in
the
stringbiulder
// xml formatted
while ((strRow = strReader.ReadLine()) != null)
{
rowNo++;
sbOut.Append("<Row><RowNo>" + rowNo + "</RowNo>" +
"<Filename>" + filename + "</Filename>" +
"<Data>" + strRow + "</Data></Row>");
}
// Write the end of the outgoing xml file
sbOut.Append("</ns0:Message>");
// close the reader
strReader.Close();
// Create a MemoryStream to store the StringBuilder-Output
MemoryStream messageStream;
// try to write the stringbuild data into a MemoryStream
and
create the
// outgoing xml message for BizTalk and add the content and
context to it
try
{
byte[] messageBytes;
messageBytes =
Encoding.UTF8.GetBytes(sbOut.ToString());
messageStream = new MemoryStream(messageBytes.Length);
messageStream.Write(messageBytes, 0,
messageBytes.Length);
messageStream.Position = 0;
IBaseMessagePart bodypart =
pc.GetMessageFactory().CreateMessagePart();
bodypart.Data = messageStream;
outMsg = pc.GetMessageFactory().CreateMessage();
outMsg.Context =
PipelineUtil.CloneMessageContext(inmsg.Context);
outMsg.AddPart("Body", bodypart, true);
}
catch (Exception e)
{
throw new ArgumentNullException(e.Message);
}
// add the message to the MessageQue
_msgs.Enqueue(outMsg);
Thank you.
René
.
- Follow-Ups:
- Re: Unparsed Interchange
- From: Armbruster, René
- Re: Unparsed Interchange
- From: Gary
- Re: Unparsed Interchange
- References:
- Unparsed Interchange
- From: Armbruster, René
- RE: Unparsed Interchange
- From: Gary
- RE: Unparsed Interchange
- From: Armbruster, René
- Unparsed Interchange
- Prev by Date: Re: SQL Receive Adapter
- Next by Date: Re: Errors using the Scripting Functoid
- Previous by thread: RE: Unparsed Interchange
- Next by thread: Re: Unparsed Interchange
- Index(es):
Relevant Pages
|