webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Posting XML to TN with amp characters

    Posted Fri March 12, 2004 06:09 PM

    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?


    #Integration-Server-and-ESB
    #B2B-Integration
    #webMethods


  • 2.  RE: Posting XML to TN with amp characters

    Posted Fri March 12, 2004 06:31 PM

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


    #Integration-Server-and-ESB
    #B2B-Integration
    #webMethods


  • 3.  RE: Posting XML to TN with amp characters

    Posted Fri March 12, 2004 06:34 PM

    Yes - this is quite common.

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


    #Integration-Server-and-ESB
    #B2B-Integration
    #webMethods


  • 4.  RE: Posting XML to TN with amp characters

    Posted Fri March 12, 2004 06:46 PM

    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.


    #webMethods
    #Integration-Server-and-ESB
    #B2B-Integration


  • 5.  RE: Posting XML to TN with amp characters

    Posted Fri March 12, 2004 07:44 PM

    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.


    #webMethods
    #Integration-Server-and-ESB
    #B2B-Integration


  • 6.  RE: Posting XML to TN with amp characters

    Posted Fri March 12, 2004 08:16 PM

    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!


    #webMethods
    #Integration-Server-and-ESB
    #B2B-Integration


  • 7.  RE: Posting XML to TN with amp characters

    Posted Fri March 12, 2004 08:30 PM

    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,


    #Integration-Server-and-ESB
    #webMethods
    #B2B-Integration


  • 8.  RE: Posting XML to TN with amp characters

    Posted Fri March 12, 2004 08:38 PM

    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.


    #webMethods
    #B2B-Integration
    #Integration-Server-and-ESB