xmlNodeToDocument and documentToXMLString

Just wondering if anyone ran into this situation when executing xmlNodeToDocument and then documentToXMLString. Basically, we have an internal application that post data directly to the flow service. The first step is execute the xmlNodeToDocument and documentToXMLString. I noticed that during the conversion, the original xml data info are not in tact. Below is an example:



As you can see, the original had xmlns info but the conversion took that out. Anyone know how I can best keep the original xml data in tact?

Can you provide a bit more detail about what the service is doing with the XML? It may be that you need not call xmlNodeToDocument and documentToXMLString. If the service is simply passing the XML string through to somewhere, there are a couple of ways that the XML string can be handled unchanged.

Hi Rob,

You are correct. The service is simply taking the xml data and send it to TN which basically will be delivered to our partner via AS2. If you know how I can pass the XML unchanged that would be great. I still would like to investigate the XML during one of the step but the service will not change the XML data.


Basically, we have an internal application that does a https post to wM which really executes the flow service. Basically, the flow service is the endpoint for the post. As I understand it, the xml comes in as a node. Which is why I execute the xmlNodeToDocument service–>documentXMLToString–>stringToStream–>EDIINT:send.

One option is to have the post specify a content type of text/plain (instead of text/xml). That way, the content handler won’t create a node object (not needed) and you can work with the string directly.

Another is to use pub.xml:queryXMLNode to get the source associated with the root node. I believe this will get you the unaltered XML string, but I’m not 100% certain. The XQL query would be /source()

Yet another would be to have the post specify application/octet, which would avoid converting the data to a string entirely. Your service would get a byte array, which could be wrapped with a stream.

Hopefully one of these will fit your needs.


Thanks for your response. I’m leaning towards the text/plain option. Is there any downfall? I still would like to analyze the xml in my steps. With this option, I then can specify the input of the flow service as a string instead of a node, correct?

Yes, you’d have an input of type string and the name needs to match what the content handler for text/plain uses (I’m not sure what that is).

With the string (or a byte array) you can do anything you want, including converting it to a node yourself.

Thanks Rob.