Webmethods Pass cXML node into HTTP Post

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.

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

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

1 Like

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

2 Likes

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

Regards,
Holger

1 Like

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?

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

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

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

2 Likes