cancel
Showing results for 
Search instead for 
Did you mean: 

Rest Adapter - Getting response message as test/csv format

former_member203764
Participant
0 Kudos

Hi PI / PO Gurus,

i know there is a thread with the same name. https://archive.sap.com/discussions/thread/3677886 But the thread is already obsolete and not resolved.

My scenario and requirement are almost same as the thread.

We are making a call to rest webservice from SAP PI and in response Rest webservice is sending response in the format of test/csv. WE need to scratch the response test/csv and put it in a file folder.

Request message : file --> SAP PI --> Rest WebService(Concur)

Response message : Rest Webservice -->SAP PI -->file without transformation.

We are using PO 7.50 SP13 Java single.

Request you to provide any inputs on handling this.

Many Thanks

Sara

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor
0 Kudos

Hi Sara!

Looking at provided screenshot it seems like you try to transform your source message from plain text to xml before sending to receiver. If you need to transform response message, I guess, that you need to put MessageTransformBean after RESTAdapterBean.

Regards, Evgeniy.

former_member203764
Participant
0 Kudos

Hi Evgeniy,

thanks a lot for your reply!

Yes. The MessageTransformBean works after putting it after the RESTAdapterBean.

But it brings the new error:

MP: exception caught with cause com.sap.aii.adapter.rest.ejb.parse.InvalidJSonContent: Invalid JSON message content used; Message: "Input is not valid JSON at character 16 of

00000009DF2E6F15;24.01.2019;f;151201000;Equip IO
00000009DF2E7DE1;24.01.2019;f;151201000;Equip IO
00000009DF2E7FB3;24.01.2019;f;151201000;Equip IO
00000009DF301239;24.01.2019;f;151201000;Equip IO

....

What for a problem this is?

Could you have any idea?

Thanks and regards

Sara

former_member190293
Active Contributor

Hi Sara!

I quess, REST adapter expects response message to be in either JSON or XML format. And it tries to process message before MessageTransformBean is called.

What happens if you set "JSON" as response message format and don't convert it to XML?

Regards, Evgeniy.

former_member203764
Participant

Hi Evgeniy,

awesome! Your two hints brought the whole thing work.

I made it also to get the text file from Rest-Service by using Async-Sync-Bridge and the dynamic URL could be filled with Xpath.

Now I have a problem with codepage, but not big thing.

Thanks and regards

Sara

Answers (4)

Answers (4)

former_member669017
Discoverer
0 Kudos

Hi Sara,

Are you able to solve this problem?Please share the solution.

former_member203764
Participant
0 Kudos

Hi Experts,

at weekend I tried with other possible configuration, i.e. the content-type under HTTP-Header is text/plain. Except this I added the MessageTransformBean in the REST-Reciver-Adapter. Now I get the TEXT file in the response, but it is not in the XML Format.

Here is the parameters of MessageTransformBean:

Now the error in the Postman is:

I think it is because the payload is not in XML and the interface cannot be satisfied.

The log means, the MessageTransformBean is executed before the message arriving End-Point, doesn't it?

Could anyone tell me why the txt cannot be transformed into XML oder how to convert the payload in the response?

I've now big headache with this problem.

Highly appreciated if anyone could give me a hint!

Regards

Sara

former_member203764
Participant
0 Kudos

Dear Manoj,

thank you for your prompt reply!

I changed the parameter of HTTP-Header as below:

Now the error looks different:

The return code points also to the unsupported media type.

The response payload in the SoupUI is so:

I should try MessageTransformBean Modules?

Could you give me more hints?

Thanks and regards

Sara

former_member203764
Participant
0 Kudos

Supplement to the above thread:

The REST-receiver can reach the endpoint and get the error: Unsupported Media Type.

But the test with SoupUI works fine.

manoj_khavatkopp
Active Contributor

Unsupported Media Type is usually due to mismatch of content type. Can you try to set that can to check again.