on 02-08-2012 6:23 AM
We're faced with a couple of integration patterns that have plain text (and in other case JSON) synchronous responses. Since PI seems to require xml in the message payload, we are facing a challenge with the implementation of these scenarios in PI.
Req: ABAP PROXY -> PI -> RESTful service
Response: RESTful service -> PI -> ABAP Proxy
We can successfully call the service using http adapter, but when the response is a plain text string and not xml, we are facing a challenge with using PI in thi scenario.
Surely there is a solution for this problem and we are not the first to have encountered it. We are using 7.1.
Appreciate any and all suggestions!
Hi Jereme,
Is the structure of your plain text data a complex one, with multiple record types and so on? If yes, then go for the Java mapping that Mark suggested. But if not, then you can try using graphical mapping:
- with the substring() function - if your plain text has no separators, just fixed field lengths;
- with a simple UDF function below, in case your plain text data has separators;
String[] results = input.split(";");
return results[sequence];
Assuming that you have two input parameters: "input" for input text data and "sequence" for the sequential number of the particular field you want to get, this function will return contents of that particular field of the plain text.
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks so much for your speedy responses.
One point of clarification - I misstated our version. 7.01 SP8
It sounds like we are very close here. However, we have one sticking point: when the text response comes from Restful web service, SAP PI does not understand the text as it cannot adhere to the XML defined by Response Message Type( Xsd based) as input to Mapping. We're not getting to the mapping because the http adapter seems to want xml (as our Response message type is defined that way).
When XI does not use mapping the response goes to ABAP proxy as it is -- Like text.
Thanks,
Jereme
Hello,
In that case you can refer to this blog
http://wiki.sdn.sap.com/wiki/display/XI/JavaMapping-ConverttheInputxmlto+String it uses the Java Mapping API before 7.1 and has a sample.
Do not worry about the text response, you can build your output XML via Java Mapping to match your proxy XML expected input.
Hope this helps,
Mark
Hello Jereme,
I've a similar requirement and trying to perform HTTP GET thorugh PI 7.31 HTTP Java adapter, My target URL looks like
I've configured my HTTP receiver adapter (Java) as below
Addressing mode - URL address
Target Host - https:abc.com
Target port: 8080
Path - /api
Where should I mention the query path - ?filterFields=<FilterFields><FilterField><Id>26</Id><Value>1/1/2013,12/31/2013</Value></FilterField></FilterFields>
Actually values inside the tag Value is dynamic and will be populated in message mapping,
What should be the value of Main Payload Parameter Name in the adapter?
Thanks in advance for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joe
I have already provided a solution for dynamic URL in the below discussion
http://scn.sap.com/thread/3464803
The value of the Main Payload Parameter Name will be the field name that will contain the actual data in URL as it is a GET request.
As I can see that in your URL the field name is filterFields.
So provide Main Payload Parameter Name = filterFields in the communication channel and populate your output Payload as
<FilterFields><FilterField><Id>26</Id><Value>1/1/2013,12/31/2013</Value></FilterField></FilterFields>
Please try this and let me know if there are any issues.
Hello,
We can successfully call the service using http adapter, but when the response is a plain text string and not xml, we are facing a challenge with using PI in thi scenario.
You can use Java Mapping to parse the response message and transform it into your desired xml format (using DOM or SAX), here is a sample API
http://wiki.sdn.sap.com/wiki/display/XI/UsingPI7.1APIforJavamapping
1. The key is to read the inputstream payload
2. Transform/parse the payload
3. Write to outputstream
Hope this helps,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.