Skip to Content

Send CSV data using REST Adapter

Feb 02 at 04:22 PM


avatar image

Hi all,

I'm trying to send a message with csv format using the REST adapter. I found this blog from rahul kumar But I get the error of XML parse. The Transformation is done OK (I've checked this with the MessageLoggerBean), but I get the error on the REST adapter module:

MP: exception caught with cause Unable to parse XML message content: "Content is not allowed in prolog."

This error is because it seems the rest module is expecting the standard xml prolog <?xml version ....

I came to that conclusion after reviewing the NWA logs:

Unexpected character 'n' (code 110) in prolog; expected '<' at [row,col {unknown-source}]: [1,1]

That 'n' is the first letter after the csv transformation. Which is correct.

The XML prolog is obviously removed with the transformation bean.

So I do not know how Rahul from the blog got this working. Any ideas?

I was able to make this work with a SOAP reciever. Can it be that the csv transformation is not supported with the REST adapter?

I'm currently using SAP PO 7.5

Thanks in advance.


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Federico del Bagno Feb 14 at 01:06 PM

Ok. I will close this now.

After creating an incident directly with SAP. I got my response.

I cannot do a MessageTransform and them expect to use the Pattern Variable Replacement. It sound logical.

Here is their response:

The error message you have encountered is caused from the configuration you have set up.
In Rest Receiver channel in tab ‘REST URL’ you have configured ‘Pattern Variable Replacement’ with an XPath expression. The problem is that when the REST Adapter try to search for this XPath expression, it already has payload in CSV format, which try to parse to XML to find the required XPath. And here it fails.
This means that you cannot extract any XPath or JSON expression because the structure of the payload is CSV and the REST adapter does not supposed to work with this kind of structure.
The only way in this case to get this ‘sessionId’ element value is to pass it to the REST Receiver channel as Dynamic attribute of the XI message/payload/.
10 |10000 characters needed characters left characters exceeded