on 12-31-2015 10:15 AM
I have a REST to ECC synchronous scenario.
I am sending a url in the response message from ECC
this is the url http://host:port/RESTAdapter/DFT/Employee/100001
the last can change accordingly
However the adapter sends it like this:
http:\/\/host:port\/RESTAdapter\/DFT\/Employee\/100001
A backward slash is inserted ahead of every forward slash in the url
Hi Midhun
I'm not sure why the sender REST channel adds the back slash when converting the response from XML to JSON.
I tried executing a conversion using my custom XML to JSON module and it does not produce extra back slashes.
You might want to open a call to SAP to ask them on this.
The only other alternative I can think of is to add an additional Java mapping in your OM after the response mapping. The Java mapping would convert the XML to JSON, so you don't use the standard channel's conversion.
Rgds
Eng Swee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Eng
JSON doesn't support forward slashes in it's payload. I guess you converted the payload without any forward slashes in payload. I have url s in payload. Those urls have forward slashes and the forward slashes in url are escaped.
It is a synchronous scenario. I have request mapping and response mapping. I don't know how to add another java mapping. Could you elaborate on that a bit? I think it is a better option than adapter module development
Regards
I converted using a URL in the payload.
Input
Output
You can add a Java mapping as a second step of the response mapping in your OM - refer below.
For the Java mapping, you can try to go JSON in Java libraries - that's the library I used for my adapter module and it converts without the additional backslash as shown above.
Rgds
Eng Swee
Hi Eng
I am also not getting backward slash when I test from SOAP UI or POSTMAN. When the webservice receive the data,they are getting backward slash. when I test with POSTMAN, my payload is just fine.
So under the Message Mapping, we have to create a new Java Mapping and write the code to convert the entire message type to JSOn right. And this mapping should be saved as external defnition and added, right
Hi Midhun,
Those back slash are escape characters i guess you are converting XML to JSON?
This is where it is being modified.
Br,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i am not sure that why, though if you want to just forward slash then, use replace function in mapping level.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mahesh
iN the mapping, I am adding it
I am concatanating http://host:port/RESTAdapter/DFT/Employee/ with the employee number send by RFC and sending it as href value.
It is not a mapping issue, I tested in mapping. The adapter is adding that.
REST does a get call, ECC responds back with data, and I pass it to the REST synchronous sender channel.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.