IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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
Expand all | Collapse all

Webmethods Pass cXML node into HTTP Post

  • 1.  Webmethods Pass cXML node into HTTP Post

    Posted Fri September 04, 2020 08:58 AM

    Hi,

    I am new to webMethods and trying to explore HTTP post scenario. we are planning to integrate ariba with webMethods. Ariba provides a cXML DTD.

    I have created documenttype using a cXML DTD and created a flow service which has input and output referring to this new document type. I add Invoke option and selected pub.http.post flowservice. Now in the pipeline screen when I try to map the cXML node to body of http post. I read the body data should go to “String” elemnet under “data” node. But when I map it I get the attached error.


    #webMethods
    #webMethods-io-Integration
    #Integration-Server-and-ESB


  • 2.  RE: Webmethods Pass cXML node into HTTP Post

    Posted Fri September 04, 2020 09:41 AM

    Hi Naresh,

    I think you are referring to service pub.client:http with method set to “post”.

    You cannot map the document directly to the http service invocation as there is no input in the http service which allow for assigning generic documents.

    You can try to convert the document to a XML string before mapping it to the http service by using services from public folder pub.xml.

    See IS Built-In-Services Reference for further informations about the services.

    Regards,
    Holger


    #Integration-Server-and-ESB
    #webMethods
    #webMethods-io-Integration


  • 3.  RE: Webmethods Pass cXML node into HTTP Post

    Posted Fri September 04, 2020 09:56 AM

    Hello Naresh,

    If you want to map then map that to /data/stream first and then convert streamToString using the built in services.

    image

    Or other option is to convert your XML document to XML string and pass it onto http POST method.

    Hope this helps.

    Regards,
    Bharath


    #webMethods-io-Integration
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Webmethods Pass cXML node into HTTP Post

    Posted Fri September 04, 2020 10:02 AM

    Hi Naresh,

    As Holger mentioned please try to invoke this service and map the input cXML (IDATA document) to document (pipelinein of document to XML String) below which converts to String (xmldata) with encode=true and map this xmldata string to client:http(data/string) before you POST to outbound endpoint.

    image

    Please test it thoroughly (monitor the pipeline especially header status code (200 or 201) you should receive.

    HTH,
    RMG


    #Integration-Server-and-ESB
    #webMethods-io-Integration
    #webMethods


  • 5.  RE: Webmethods Pass cXML node into HTTP Post

    Posted Fri September 04, 2020 10:30 AM

    Additionally specify the doc type name as the document reference parameter.

    Regards,
    Holger


    #webMethods-io-Integration
    #Integration-Server-and-ESB
    #webMethods


  • 6.  RE: Webmethods Pass cXML node into HTTP Post

    Posted Sat September 05, 2020 07:08 AM

    Thank you so much. one problem solved.

    I have created the flow services like below

    Ariba is expecting body of the post request something like below
    `

    <?xml version="1.0" encoding="utf-8"?>
    
    <!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.046/cXML.dtd">
    
    <cXML payloadID="AF9M-C2jLNysay6nh6aY_h164Bvu"
    
    timestamp="2020-09-02T00:16:30Z">
    

    `

    when I run the flow service and input the values manually like below

    I am getting bosy like below ( I am giving only the starting part of the body which is not coming as expected)
    `

    <?xml version="1.0" payloadID="123456fsdfewrer" timestamp="2020-09-02T00:16:30Z"?>

    `
    what i am missing is cXML tag and also<!DOCTYPE> entry. Also payload ID and timestamp should come inside cXML tab. how do I get those?


    #webMethods-io-Integration
    #Integration-Server-and-ESB
    #webMethods


  • 7.  RE: Webmethods Pass cXML node into HTTP Post

    Posted Sun September 06, 2020 06:59 AM

    HI,

    i am able to achieve this after reading some posts in this forum. I have another issue, but i will close this question and raise another one. solution for my problem is


    #webMethods-io-Integration
    #webMethods
    #Integration-Server-and-ESB


  • 8.  RE: Webmethods Pass cXML node into HTTP Post

    Posted Mon September 07, 2020 06:19 AM

    Hi,

    Looks like the pub.xml:documentToXMLString is not behaving correctly. (mixing up the xml header attributes with the cxml node attributes).

    When you say you have the document type generated from a DTD, then provide this generate node to the parameter documentTypeName of pub.xml:documentToXMLString.

    Additionally when defining the inputs of your service map_cxml use a Document Reference for your input variable and point it to the generated document type.

    Regards,
    Holger


    #webMethods
    #Integration-Server-and-ESB
    #webMethods-io-Integration


  • 9.  RE: Webmethods Pass cXML node into HTTP Post

    Posted Tue September 08, 2020 12:59 PM

    Yes you need to fill the documentTypeName (Document reference) that you have created from the cXML schema/dtd and that should do most of the work when generating String (xmldata) fully-formed namespace/tags for you.

    If this still didn’t work for you then you may need to manipulate the xmldata string (with replace service and add the static DOCTYPE tag in the header right below the ?xml version tag.

    Can you try with that param above and troubleshoot it again.

    HTH,
    RMG


    #webMethods
    #webMethods-io-Integration
    #Integration-Server-and-ESB