Hi Experts,
I have a sync scenario between Legacy & SAP ECC system.
Legacy <--REST--> SAP PI <--PROXY-->.
When i invoke REST end point through SOAP UI using POST operation I am getting expected result but, when i change the operation from POST to GET & send the value in URL then I could only see response with no values and this is because PI is sending message structure with out any field values in it as shown in below figures.
Screen shot 1: Message is containing only root element with out any field name & value for it.Field 'po_number' is missing from the content when using GET operation.
Structure designed ESR with field po_number. (Fig 2)
REST sender adapter configuration with GET Operation.
Below response is because the value for field 'po_number' what i am passing is not being sent to SAP ECC (refer fig 1), so i am getting response as No PO
I tried many option available under REST Resource, REST Operation & Operation Determination tabs provided in REST adapter but could not get/read value for po_number from URL into the message, so could some one really help me in configuring what i am missing so that i can get the value from URL in to my message content.
Thanks,
Farooq
Hi Mohammed,
You need to use your REST channel as a receiver (with POST operation) in your message mapping lookup. You are getting this error because your REST server is only configured to give a response on a POST operation with PO number and not GET. Let me know if you face any issues post implementing the lookup.
Regards,
Karthik
Hi Karthik,
I am sorry, I could not understand why should I use REST receiver channel & I am not doing any look up in mapping. My scenario is as below..
Legacy <----REST----> SAP PI <-----PROXY----->SAP ECC.
My configuration is similar to the one listed in the below thread.
https://archive.sap.com/discussions/thread/3924907
Please let me know what i am missing in my REST adapter.
Regards,
Farooq
Hi Mohammed,
Apologies, I misunderstood your scenario earlier. You can try following the below method which is also given in one of the blogs related to REST.
General tab is same as what you have used.
In Channel Selection Tab check the 'Limit to HTTP Operation' option to allow only GET calls
In REST Resources tab define a variable under URL Pattern 'po_id' which would be your dynamic po number value that you will pass in the url
Under XI Dynamic Attribute select REST ID (id) and refer to the Pattern element 'po_id' which has the PO number from the URL. This setting will save the PO number in the Dynamic Config header under attribute 'id' and namespace 'http://sap.com/xi/XI/System/REST' which you will have to extract in your message mapping using the below udf-
public String GetPONumber(String namespace, String attribute, Container container) throws StreamTransformationException{
{
Map<String, Object> all = container.getInputHeader().getAll();
DynamicConfiguration dynConf = (DynamicConfiguration)all.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(namespace, attribute);
return dynConf.get(key);
}
Pass the values for namespace as 'http://sap.com/xi/XI/System/REST' and attribute as 'id' in your mapping and feed the return value from udf to your required po_number field in your target structure (same as your source structure which you have specified. Use the below format of url to call the REST service from SOAP UI-
http://<host>:<port>/RESTAdapter/Wareasy/PurchaseOrder/<PurchaseOrder>
Hopefully this should solve your issue. You can refer to the below blog as well which explains this method-
https://blogs.sap.com/2014/12/18/pi-rest-adapter-exposing-a-function-module-as-restful-service/
Regards,
Karthik
Hi Karthik,
Thanks a lot for your reply.
I did the configuration as you said but now getting error as show below..
My REST sender channel name is CC_REST_Sender_PurchaseOrder, which I could see in Error logs but my error logs also states that "No channel found to handle "GET" request to "/Wareasy/PurchaseOrder/" as shown in screen shot 1.
Regards,
Farooq
Hi Mohammed,
You need to have the resource path url in the below format in your SOAPUI. Leave the parameters section blank and include the PO number in the Resource path url.
This should do the work.
Regards,
Karthik
Hi Karthik,
Thanks for your response again, now I am getting desired result. But, still I have some doubts i.e. is this is the only way to configure GET operation? I mean do we need to always use Dynamic Configuration for GET operation? Could you please let me know if there is any other way to configuration this?
Also, why cant I use field name along with value in URL like as shown in Error screen shot 1.
Once again thank you for your help.
Regards,
Farooq
Hi Mohammed,
Good to know that this works! This is the best possible way that GET operation can be configured, however, since REST adapter is highly customizable, you can explore other options as well :)
Yes you can use field name along with value in URL as shown below-
Configure Endpoint as
http://<host>:<port>/RESTAdapter/Wareasy/PurchaseOrder/?purchaseOrder=
and call from SOAP UI in the below format-
http://<host>:<port>/RESTAdapter/Wareasy/PurchaseOrder/?purchaseOrder=<PurchaseOrder>
Regards,
Karthik