cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP Headers in Response

maheswarareddykonda
Active Contributor
0 Kudos

Hi Experts,

I am working on Proxy to rest , synchronous scenario and using POST method. Whenever data triggers in ECC that data need to be created in rest server and send back "Location" which comes in Response Header and there is no data in Body.

The same location data we need to capture anyway and send back to ECC.

Note: i had checked with SAP people regarding this..they were saying that feature planning to release 7.4 SP13 which is planned to be released only in November 2015.

So please help me to how to handle this situation.if you could provide custom module

also appreciate if you could provide code for custom adapter module.

Thanks & Regards,

Maheswarareddy

ONavas
Participant
0 Kudos

Hello Maheswara,


I have the same requirement, reading the content of the response header in a REST adapter in PO 7.5 SP20 with the GET method.

Can you confirm if you have solved this question and explain how to do it?

Thanks in advance

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Have you tried the Prolog of the communication channel?

It might work with that.

Regards,

J

maheswarareddykonda
Active Contributor
0 Kudos

Hi Janan,

Please can you let me know what is 'Prolog' of a communication channel?

Thanks,

Maheswara.

former_member435532
Participant
0 Kudos

Hello Maheshwara,

can you please tell me how to achieved your requirement. my requirement is exactly similar to you (reading the location field from http response header and passing it to SAP r/3). thanks in advance for your help on this.

Would appreciate and early response.

Regards/Ajay

suchitatomar
Participant
0 Kudos

Hi Ajay,

Request you to create a new thread to get prompt response, with your requirement and screen shot if necessary.

Regards

S Tomar

former_member435532
Participant
0 Kudos

Hello,

I already have  thread for this, just saw that this thread has same requirement as mine so thought if Maheswara can reply with solution.

Regards/Ajay

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Maheswarareddy,


I am working on Proxy to rest , synchronous scenario and using POST method. Whenever data triggers in ECC that data need to be created in rest server and send back "Location" which comes in Response Header and there is no data in Body.

The same location data we need to capture anyway and send back to ECC.

In the SOAP receiver adapter (or even HTTP/HTTP_AAE) you can add HTTP headers in a request but cannot read an additional header in the response. However, if you remote-enable the standard SAP function module HTTP_POST, it is now possible to read the response headers.

Here is a POC I've done three years ago

The idea is to make your scenario Proxy to RFC. The RFC will trigger the POST to the rest webservice and in it you can read the response HTTP headers. Other than that, I do not see any other way other than a lookup. In the API for adapter module, only the content-type can be set, so we are out of options here.

Hope this helps,

Mark

maheswarareddykonda
Active Contributor
0 Kudos

Hi Mark,

I have read through the PoC document you have shared above. I am a little confused about how the RFC triggers the POST to the REST web service. Is it that the RFC is coded in such a way that it calls a URI and sends a POST request to it?

Also, I am confused about how my end to end design of the interface will be. Is it that i need to replicate this FM on the ABAP stack of PI and then do a look up on it. What will my receiver system be in that case?

Also, this give rise to a question on whether this call can be done directly from ECC? Do we really need to involve PI in the picture?

Thanks,

Maheswara.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Maheswara,

Thank you for the questions. Here are my answers:


Is it that the RFC is coded in such a way that it calls a URI and sends a POST request to it?

Yes, it calls a URI/URL and then sends a POST request to it.


Also, I am confused about how my end to end design of the interface will be. Is it that i need to replicate this FM on the ABAP stack of PI and then do a look up on it. What will my receiver system be in that case?

Well remote-enabling the FM will allow you to do a lookup, but if you are concerned with a receiver just do Proxy <-> PI (receiver). In that case, the receiver would be your PI system (as a business system).


Also, this give rise to a question on whether this call can be done directly from ECC? Do we really need to involve PI in the picture?

Yes, this call can be done directly in ECC. If you use IF_HTTP_CLIENT, then it would be more flexible. The involvement of PI can be answered on the question of how many point-to-point connections you intend make. One of PI's main function is to minimize P2Ps (even eliminate it completely) and reduce the TCOs (Total Cost of Ownership) associated with it.

Regards,

Mark

former_member183816
Active Participant
0 Kudos

One thought,

Write a UDF for HTTP GET Request and extract location from HTTP response header in your response mapping.

In another words : HTTP look up

Code can be derived from this link as per your requirement.

Using java.net.URLConnection to fire and handle HTTP requests? - Stack Overflow

maheswarareddykonda
Active Contributor
0 Kudos

Hi Ambuj,

Thanks for sharing the HTTP Look up code. I first need to be sure if the receiver REST channel is able to accept the HTTP Header parameter that is being returned by the receiver REST system. I am no where able to see this header parameter in PI. Hence i am a liitle unsure as of now if this is being captured in PI in the first place. Will try to check this with the help of XPI inspector. Any other ways of checing the same?

Thanks,

Maheswara.