Topic
  • 5 replies
  • Latest Post - ‏2013-01-16T20:12:04Z by HermannSW
SystemAdmin
SystemAdmin
6772 Posts

Pinned topic Problem with recieving JMS over MQ messages

‏2010-09-10T08:13:11Z |
Hi everyone,

I have problem with receiving an MQ message which was sent from a Message Driven Bean using JMS. Datapower can not parse this message and throws an error:

illegal character 'R' at offset 0

When I turn on an option "Rules and Formatting Header (MQRFH2)" on Front Side Handler the error message is changed to:

illegal character 0xe3 at offset 0

I tried different combinations with options on both Datapower and WebSphere App Server with MDB deployed (on WAS I use WebSphere MQ messaging provider with factory to send the message). I also tried to add a fatch action to the policy with a binary (not XML input) but it didn't helped also.

I would really appreciate any help, I've searched the forum and the internet but have found nothing helpful.

The message in the probe shows no content, only 5 headers:
  • MQMD,
  • X-MQRFH2-Data0,
  • X-MQRFH2-Data1,
  • MQRFH2,
  • Content-Type

Thanks!
Sebastian
Updated on 2013-01-16T20:12:04Z at 2013-01-16T20:12:04Z by HermannSW
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: Problem with recieving JMS over MQ messages

    ‏2010-09-14T20:13:15Z  
    OK, it turned out that the backed server who is sending the messages over JMS added <?xml version="1.0" encoding="UTF-16"?> in the begining of the XML message. When I removed this tag Datapower accepted the message.

    Anyone know why is that? I mean, why DP will not accept XML with the encoding tag at front?

    Regards,
    Sebastian
  • HermannSW
    HermannSW
    4657 Posts

    Re: Problem with recieving JMS over MQ messages

    ‏2010-09-15T13:02:35Z  
    OK, it turned out that the backed server who is sending the messages over JMS added <?xml version="1.0" encoding="UTF-16"?> in the begining of the XML message. When I removed this tag Datapower accepted the message.

    Anyone know why is that? I mean, why DP will not accept XML with the encoding tag at front?

    Regards,
    Sebastian
    Sebastian,

    > OK, it turned out that the backed server who is sending the
    > messages over JMS added <?xml version="1.0" encoding="UTF-16"?>
    > in the begining of the XML message. When I removed this tag
    > Datapower accepted the message.
    >
    > Anyone know why is that? I mean, why DP will not accept XML with
    > the encoding tag at front?

    DataPower can handle XML declarations and encodings.

    What I suspect is that your XML declaration said that the document IS UTF-16 encoded but it was not.

    May you attach a sample message (attach is important for not changing the message) for investigation?

    Be aware that removing the XML declaration in an editor will change the encoding of the message to whatever your text editor decides ...

    Hermann.

    P.S:
    The removal seems not to be a real workaround since you will not want to edit all messages.
    Did you make the Message Driven Bean not send the XML declaration ?
    If not you might be interested in this slide on how to deal with incorrect XML declarations:
    http://www-01.ibm.com/support/docview.wss?uid=swg27019119&aid=1#page=6
    ("Repairing broken Web services")
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: Problem with recieving JMS over MQ messages

    ‏2010-10-04T08:11:20Z  
    • HermannSW
    • ‏2010-09-15T13:02:35Z
    Sebastian,

    > OK, it turned out that the backed server who is sending the
    > messages over JMS added <?xml version="1.0" encoding="UTF-16"?>
    > in the begining of the XML message. When I removed this tag
    > Datapower accepted the message.
    >
    > Anyone know why is that? I mean, why DP will not accept XML with
    > the encoding tag at front?

    DataPower can handle XML declarations and encodings.

    What I suspect is that your XML declaration said that the document IS UTF-16 encoded but it was not.

    May you attach a sample message (attach is important for not changing the message) for investigation?

    Be aware that removing the XML declaration in an editor will change the encoding of the message to whatever your text editor decides ...

    Hermann.

    P.S:
    The removal seems not to be a real workaround since you will not want to edit all messages.
    Did you make the Message Driven Bean not send the XML declaration ?
    If not you might be interested in this slide on how to deal with incorrect XML declarations:
    http://www-01.ibm.com/support/docview.wss?uid=swg27019119&aid=1#page=6
    ("Repairing broken Web services")
    Hermann,

    Unfortunately I don't have any access to DataPower at the moment. I have created a PoC on client machine and I finished my work at the project. As for your questions:

    • Yes I changed the MDB not to send the UTF16 declaration because it was a clients application and it was, well not really generating valid results as it turned out, plus I tuned it a little bit. How can I check if the XML is not UTF16 valid?

    I attach my XML message in RFHUtil format (the only one I got right now), you can preview its content in Data tab in RfhUtil.

    Thank you very much for your post and the link!
    Cheers!
    Sebastian
  • samanderson
    samanderson
    172 Posts

    Re: Problem with recieving JMS over MQ messages

    ‏2013-01-16T07:52:53Z  
    • HermannSW
    • ‏2010-09-15T13:02:35Z
    Sebastian,

    > OK, it turned out that the backed server who is sending the
    > messages over JMS added <?xml version="1.0" encoding="UTF-16"?>
    > in the begining of the XML message. When I removed this tag
    > Datapower accepted the message.
    >
    > Anyone know why is that? I mean, why DP will not accept XML with
    > the encoding tag at front?

    DataPower can handle XML declarations and encodings.

    What I suspect is that your XML declaration said that the document IS UTF-16 encoded but it was not.

    May you attach a sample message (attach is important for not changing the message) for investigation?

    Be aware that removing the XML declaration in an editor will change the encoding of the message to whatever your text editor decides ...

    Hermann.

    P.S:
    The removal seems not to be a real workaround since you will not want to edit all messages.
    Did you make the Message Driven Bean not send the XML declaration ?
    If not you might be interested in this slide on how to deal with incorrect XML declarations:
    http://www-01.ibm.com/support/docview.wss?uid=swg27019119&aid=1#page=6
    ("Repairing broken Web services")
    Hi Hermann -

    I have similar issue where DP fails implied parse action for incoming request containing encoding UTF-16 and same request goes through
    Datapower if it is UTF-8. Error I am getting for UTF -16 is Parse input as XML failed: illegal character 0xe3 at offset 0. Is it because xml doesn't contain UTF-16 data ? Is there a tool that I can use to check if the encoding used is correct.
  • HermannSW
    HermannSW
    4657 Posts

    Re: Problem with recieving JMS over MQ messages

    ‏2013-01-16T20:12:04Z  
    Hi Hermann -

    I have similar issue where DP fails implied parse action for incoming request containing encoding UTF-16 and same request goes through
    Datapower if it is UTF-8. Error I am getting for UTF -16 is Parse input as XML failed: illegal character 0xe3 at offset 0. Is it because xml doesn't contain UTF-16 data ? Is there a tool that I can use to check if the encoding used is correct.
    Hi,
    >
    > I have similar issue where DP fails implied parse action for incoming request containing encoding UTF-16 and same request goes through Datapower if it is UTF-8.
    > Error I am getting for UTF -16 is Parse input as XML failed: illegal character 0xe3 at offset 0. Is it because xml doesn't contain UTF-16 data ?
    >
    yes.

    > Is there a tool that I can use to check if the encoding used is correct.
    >
    "illegal character 0xe3 at offset 0" does tell you that the encoding is not prefixed by a BOM (Byte Order Mark, UTF-8/16/32).

    May you attach (not copy in) a sample file?

     
    Hermann<myXsltBlog/> <myXsltTweets/>