Posting XML to TN with amp characters

A trading partner is trying to post an xml document to wm.tn:receive. The xml they are sending contains “&” characters and is not xml encoded. When trading networks receives the xml, it does not recognize the document sender, receiver or identifying query.

Has anyone else run into this problem?

It’s the partner’s responsibility to encode the ‘&’. That is a special character in XML - therefore their file is NOT valid.

Yes - this is quite common.

The best solution is that your trading partner properly encodes the document - as it currently not valid xml!

Hi,

Some work around would be needed to solve this issue internally.

Instead of directly posting to TN gateway service create a custom flow service and give the service URL to the trading partner if they are not properly encoding the XML.
So the cusotm service receives XML document as (Node object) and parse the XMl document using xmlNodeToDocument and DocumentToXMLString (set encode parameter=true)which will treat Special characters (&,<,> and encode as (&,<>)… which gives encoded xmldata and finally route xmldata to TN (via routeXML or tn.receive) service.

This makes the control and handled in wmside and not the trading partner that can smoothly process the transactions.

I don’t think that would work - you just want to encode the & not the <,>,etc so you’d have to replace the ampersands with @amp; only then submit to TN.

Thanks for the quick response. I think I’ll have the trading partner correctly encode their xml. Quickest solution to the problem.

Thanks for the input!

Will,

Just with Setting (encode=True) in DocumenToXMLString this will automatically set the & to & and then it output the valid xmldata.So no explicit replace logic required.

I hope you got my point.

Thanks,

Will,

Ignore my last post.It was fast and you are right…we have to explicitly put & in the xml, otherwise xmlNodeToDocument will fail.

Thanks.