RE: Unparsed Interchange
- From: Armbruster, René <ArmbrusterRen@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 22 Nov 2006 01:14:01 -0800
Hi Gary,
thanks again. Yes, the spellings of the namespace is correct. There are no
properties promoted or anything.
Do I need to promote a message type or anything?
Regards
René
"Gary" wrote:
Hi,.
If your message is appearing in HAT with the correct body etc then the
chances are that it may not be anything to do with the stream. Can you check
which properties have been promoted etc? Are the spellings correct for the
namespace etc?
Gary
"Armbruster, René" wrote:
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é
- References:
- Unparsed Interchange
- From: Armbruster, René
- RE: Unparsed Interchange
- From: Gary
- RE: Unparsed Interchange
- From: Armbruster, René
- RE: Unparsed Interchange
- From: Gary
- Unparsed Interchange
- Prev by Date: RE: Unparsed Interchange
- Next by Date: Re: SQL Receive Adapter
- Previous by thread: RE: Unparsed Interchange
- Next by thread: Re: Unparsed Interchange
- Index(es):
Relevant Pages
|