MSMQ message format

Home Page Forums BizTalk 2004 – BizTalk 2010 MSMQ message format

Viewing 1 reply thread
  • Author
    Posts
    • #16273

      I've .net application that recieves a string that contains xml according to an exact biztalk schema (i.e. mentions the schema namespace and all the xml). That application in turn puts that message to MSMQ where from biztalk will pick it up.

      The problem is .net application, which uses this code:

      Message messageToSend = new Message(xmlStrToSend);

      new Message(xmlStrToSend);

      sendQueue = new MessageQueue();

      sendQueue.Path = ".\\private$\\" + queueName;

       

      sendQueue.Send(messageToSend); 

      Appends its own xml at the beginning and end of the message, like <xml 1.0> <string> </string>, this is due to the default XmlFormatter that it uses for sending objects to MSMQ. But this destroys my message in string, which is built exactly according to the schema and Biztalk gives error, seeing the appended message by .net. I've looked quiet a bit into it but cant find any way of getting rid of this appended xml by .net object to MSMQ, I want the exact string pushed to the MSMQ not any appending. and I am dependent on using the Message object as I need its ID to correlate the response message.

      Any help would be very appreciated!!

       

      Regards,

      Sajid.

       

      sendQueue.Path = ".\\private$\\" + queueName;

       

      sendQueue.Send(messageToSend); 

      Appends its own xml at the beginning and end of the message, like <xml 1.0> <string> </string>, this is due to the default XmlFormatter that it uses for sending objects to MSMQ. But this destroys my message in string, which is built exactly according to the schema and Biztalk gives error, seeing the appended message by .net. I've looked quiet a bit into it but cant find any way of getting rid of this appended xml by .net object to MSMQ, I want the exact string pushed to the MSMQ not any appending. and I am dependent on using the Message object as I need its ID to correlate the response message.

      Any help would be very appreciated!!

       

      Regards,

      Sajid.

       

       

      sendQueue.Send(messageToSend); 

      Appends its own xml at the beginning and end of the message, like <xml 1.0> <string> </string>, this is due to the default XmlFormatter that it uses for sending objects to MSMQ. But this destroys my message in string, which is built exactly according to the schema and Biztalk gives error, seeing the appended message by .net. I've looked quiet a bit into it but cant find any way of getting rid of this appended xml by .net object to MSMQ, I want the exact string pushed to the MSMQ not any appending. and I am dependent on using the Message object as I need its ID to correlate the response message.

      Any help would be very appreciated!!

       

      Regards,

      Sajid.

       

    • #16274

      Sajid,

      The easiest way is to change your .NET application so that it creates the MSMQ message not using a formatter, but instead directly writing into the BodyStream property of the Message object. That will sidestep any formatting issue and ensure you have complete control over what gets sent over MSMQ. Do take care to ensure you send the message in an encoding BizTalk can understand later!

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.