cancel
Showing results for 
Search instead for 
Did you mean: 

Help on custom Adapter module to set HTTP Header

yasha_dubey
Participant
0 Kudos

Hello All,

I have to write a custom adapter module to set HTTP headers.

I have been looking to PI JAVA docs but didn't find any suitable class/method to write or set header. I do see get header methods but nothing to set except for set content type.

Please let me know which class/ interface can I use for to achieve this.

The HTTP parameters that I want to add are :

"Access-Control-Allow-Origin" = "*"

"Access-Control-Allow-Headers" = "Authorization"



Thanks,

Pragya

Accepted Solutions (0)

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Pragya,

What is your scenario? You can actually include custom http header fields via SOAP receiver adapter XHeaderName1..3 .

Regards,

Mark

yasha_dubey
Participant
0 Kudos

Hi Mark,


scenario synchronous call from Portal as shown below

Portal ----> SAP PI --->  ECC . I am using Rest Adapter as I have JSON to XML conversion and vice versa.

I have Rest to Soap. Unfortunately, in Rest Sender (HTTP) I don't have option to set header .

Thanks,

Pragya

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Pragya,

Sorry I do not have REST adapter, but why do you need to set the for the request?

I think PI will still accept the request from Portal even without the HTTP Headers mentioned below.


"Access-Control-Allow-Origin" = "*"

"Access-Control-Allow-Headers" = "Authorization"

Regards,

Mark

yasha_dubey
Participant
0 Kudos

Hi Mark,

The problem is not with SAP PI but with portal.

When PI sends the response to POrtal, it fails in Chrome as Chrome expects these parameters.

However, it works fine with Internet Explorer

Thanks,

Pragya