Hello,We have a Multi-Protocol Gateway where we need to log the incoming request to be able to use it later for calculating checksum.The problem is that the XML-declaration is missing in the log.We don't do any transformation or anything before logging.Also when I look at the request input in the probe the XML-declaration is missing.Start of request:<?xml version="1.0" encoding="UTF-8"?><Document xmlns=...Start of log:<Document xmlns=...I did a packet capture to make sure that the XML-declaration is OK when the request arrives at DP.Is the any way to make the XML-declaration visible?Edit:
If I set Request Type to Non XML I can see the declaration in the probe.
As soon as it is parsed to XML, the declaration disappears.RegardsJocke D------------------------------Joacim Dahlblom------------------------------
Jocke,Thanks for the question!
Explanation of the behaviorFor Request Type of "XML", the MGPW will usually automatically parse the input as XML, so it is then an XML Infoset and not XML serialized as bytes anymore.The XML Infoset specification is here: http://www.w3.org/TR/xml-infosetThe Document Information Item in the XML Infoset has a property [character encoding scheme] but it does not have an XML Declaration per-se.For Request Type of "Non XML", the MPGW is not parsing it by default, so you still have the input XML serialized as bytes, including your XML Declaration.Options you can chooseThere are many options of what you can do, all around what behavior you want and how much performance you're willing to "spend" on parts of that behavior.(Option 1) In an MPGW, you can use XSLT via an XForm Action to serialize your XML however you like, including with an XML Decl, and then log that.(Option 2) MPGW also supports the Parse policy so you could parse it as XML after you log it.(Option 3) Or you can decide that it's ok to not have an XML declaration in the log as long as the XML you see is spec-compliant as the same XML infoset.For example, UTF-8 data does not require an XML declaration to identify it as UTF-8 according to the XML specification, since it is automatically inferred.So it could be ok for your log to be the same Infoset, which means the same semantic data from an XML perspective, while not being the exact same bytes.The XML specification is here: https://www.w3.org/TR/xml/That's three options of how to proceed. As you can see they are all depending on what your real requirements are.Hopefully at least the explanation helps for why you're seeing the behavior that you get.
Thanks for the answer Morris Matsa.
Yes now I understand the behavior but I can't really solve my problem.
I have to forward the request looking exactly as it came in.
Need to work on that. :)
> I have to forward the request looking exactly as it came in.
DataPower log has default XML encoding UTF-8.So if your request comes with a different encoding, it will be logged UTF-8 encoded."exactly as it came in" is a Non-XML requirement, so you need Non-XML procedures.Even then you cannot get non-UTF8 encoding in DataPower log.The best you have is to log the original unparsed message base64 or hex encoded.