on 2022 Jan 22 2:21 PM
Hello Experts,
I am working on fetching Contract Request cXML from Ariba Network. I need to convert the cXML into JSON to send to target system. But the message which I am getting from Ariba Network is of this format (I have removed/altered some actual content) -
------=_Part_8869_950514950.1642859653328
Content-Type: text/xml; charset=UTF-8
Content-ID: XXXXXXXXXX.XXXXXXXX@app1008.snv.ariba.com
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.052/Private.dtd">
<cXML timestamp="2022-01-22T05:54:13-08:00" payloadID="9999999999999-6666666666666835933@77.777.77.777">
<Response>
<Status code="200" text="OK"/>
<DataResponse>
<Attachment>
<URL>XXXXXXXXXX.XXXXXXXX@app1008.snv.ariba.com</URL>
</Attachment>
</DataResponse>
</Response>
</cXML>
------=_Part_8869_950514950.1642859653328
Content-Type: text/xml; charset=UTF-8
Content-ID: XXXXXXXXXX.XXXXXXXX@app1008.snv.ariba.com
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cXML SYSTEM "http://xml.cxml.org/schemas/cXML/1.2.042/Contract.dtd">
<cXML payloadID="1572609866292.423681963.000001843@NMC8pBEXStATEUCcgVjhR3bzQ00=" timestamp="2019-11-01T05:04:26-07:00" version="1.2.042" xml:lang="en-US">
<Header>
</Header>
<Request deploymentMode="test">
<ContractRequest>
<ContractRequestHeader>
</ContractRequestHeader>
<ContractItemIn operation="new">
</ContractItemIn>
</ContractRequest>
</Request>
</cXML>
------=_Part_8869_950514950.1642859653328--
How to read the actual cXML content from this entire Multipart message? How to parse it? Which message transformer should be used?
I tried using MIME Multipart decoder but it is not doing anything.
I tried setting the flag and removing too - Multipart Headers Inline but it doesn't change anything.
In headers, I am getting the boundary of Multipart message in header. In groovy script, I can split the message at boundary but after that still the Content-Type and Content-ID before prolog of cXML are present in the split message. As the content-ID will be unique in every message, I am unable to find a decent/standard way of reading cXML part and pass it to message mapping step.
Regards,
Yayati Ekbote
Request clarification before answering.
Hi,
If possible, I would use a splitter so that you can process each "part" individually. Then I would store the Content-type and Content-ID as custom headers, followed by a filter/groovy script to get just the XML section where I would then do whatever needs to be done to the XML part such as a message mapping if required. Then use the standard XML to JSON transformer. You can then send these messages one by one to the destination.
Kind regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
12 | |
9 | |
8 | |
7 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.