Re: Unparsed Interchange



Yep,

As Greg has said, the message type property needs to be promoted in order
for BizTalk to match it. Although you are copying the message context it
looks like it does not keep the promoted properties.

You may need to have something like the following:

outMsg.Context.Promote("MessageType",
"http://schemas.mircosoft.com/BizTalk/2003/system-properties"; ,
YourMessageType);

where YourMessageType is the target namespace of your message and the hash
and the typename I believe.

TargetNamespace#Typename

Gary



"Greg Forsythe" wrote:

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é



.



Relevant Pages

  • RE: Unparsed Interchange
    ... but have you tried setting your stream position back ... from the received one (flat recieved -> xml out with some new parameters). ... // Get the original filename ... string filename = inmsg.Context.Read("ReceivedFileName", ...
    (microsoft.public.biztalk.general)
  • Re: Unparsed Interchange
    ... But anything after that won´t work anymore (no xml validation, ... but have you tried setting your stream position ... // Get the original filename ... string filename = inmsg.Context.Read("ReceivedFileName", ...
    (microsoft.public.biztalk.general)
  • Re: Unparsed Interchange
    ... This is normally done by the Flat File Disassembler or XmlDisassembler. ... But anything after that won´t work anymore (no xml validation, ... // Get the original filename ... string filename = inmsg.Context.Read("ReceivedFileName", ...
    (microsoft.public.biztalk.general)
  • RE: Unparsed Interchange
    ... but have you tried setting your stream position back ... from the received one (flat recieved -> xml out with some new parameters). ... // Get the original filename ... string filename = inmsg.Context.Read("ReceivedFileName", ...
    (microsoft.public.biztalk.general)
  • Re: ImageList for Console Application
    ... I don't know if this will work with a stream from the resource..but here is ... public string WriteToTempFile ... System.IO.StreamWriter writer = null; ... fileName = System.IO.Path.GetTempFileName; ...
    (microsoft.public.dotnet.general)

Quantcast