cancel
Showing results for 
Search instead for 
Did you mean: 

Odata, Reading Custom Header Problem

Former Member
0 Kudos

Hi Experts,

how can i read custom http header inside my DPC_EXT class. i am using gateway client there i am creating one custom HTTP header like below

Name : Mytest

value  :mytests value

i am sending request using GET method

inside my DPC_EXT method i am using below lines to access http header , but i am not getting.

Data :  Lo_facade type ref to /IWBEP/IF_MGW_DP_INT_FACADE,    

lt_client_headers type TIHTTPNVP.

lo_facade ?= /iwbep/if_mgw_conv_srv_runtime~get_dp_facade( ).

lt_client_headers = lo_facade->get_request_header( ). 

Regards

Saumya

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Soumya,

you can check if you are really sending the header in Chrome.

Press f12, select tab Network, then perform your oData action and you should see HTTP request header as it is here https://developer.chrome.com/devtools/docs/network#http-headers

Regards,

Peter

Former Member
0 Kudos

should i check in chrome or mozila?

Former Member
0 Kudos

Chrome.

Former Member
0 Kudos

please check my screen shots

ChandraMahajan
Active Contributor
0 Kudos

where are you passing values in request header? you need to press Add Header icon in HTTP Request screen(left side of 1st screen) and then enter values in the popup which you will be able to see in DPC_EXT method.

Former Member
0 Kudos

Same i am doing but still  its not coming.

Former Member
0 Kudos

How can i add extra header in chrome.Shall i need to install Rest client for chrome?

Former Member
0 Kudos

i tried with chrome advanced rest client , there its showing my custom header but in my dpc methods its not coming . Please check the screen shots.

"MY"  is the header name and "RAMESH"  is the value please check.

Former Member
0 Kudos

Hi,

I check it and it is working for me smoothly. Maybe you can think of sending parameters to backend in key field. What kind of information do you need send to backend?

Best regards,

Peter

Former Member
0 Kudos

have you seen my r3 screenshots or not? There,   peter i have only added one extra header  name  taht is "SAP" and value "appl".

I want to send value for 8 to 10 fields.

Saumya

ChandraMahajan
Active Contributor
0 Kudos

I see you put the code in GET_STREAM method. put the same code in GET_ENTITY method and you will be able to get the value.

But anyway it should also work in GET_STREAM method. I just redefined this method in my DPC_EXT class and put the same code and I am able to see the values.

Message was edited by: Chandrashekhar Mahajan

Former Member
0 Kudos

i tried with only get_entity but same, nothing is coming.Please help me.

ChandraMahajan
Active Contributor
0 Kudos

so you are having Z DPC_EXT class and then redefining GET_ENTITY or GET_STREAM method right and then put the code. please confirm. because I just redefined both methods in my ZDPC_EXT class and then put the same code and able to see the custom header values.

Former Member
0 Kudos

Same thing i am doing , idont know why its not coming in my case. Please help me.

Saumya

Former Member
0 Kudos

Hi Peter,

Please help me  regarding our yesterday discusiion on custom header in http

request. Please.

Or else if you want share my screen you can share.Please help me

Regards

Saumya

Former Member
0 Kudos

Hi Soumya,

is is strange, it does not work, I don't know why.

I guess you have two options:

1. Contact OSS support, raise message to SAP, they will help you

2. Do not send parameters in header, but as a Key Field. Just extend your entity with more key fields and provide their values in url. Is this a problem for you?

Regards,

Peter

Former Member
0 Kudos

i can extend my entity but  which one will be the best way?as a header or keyfields?

Regards

Saumya

Former Member
0 Kudos

Peter i am working as a C user in SAP-LABS bangalore, INDIA.So how can i send OSS message .

Former Member
0 Kudos

Thanks peter i checked its working in different system, but not working on my system. I think SP issues.

ChandraMahajan
Active Contributor
0 Kudos

The code is correct. I hope you are inserting header name and value in request header. you should get those values in lt_client_headers.

Regards,

Chandra

ChandraMahajan
Active Contributor
0 Kudos

you need to put external breakpoint in DPC_EXT method where you put the code and then execute the uri again in gateway client. control will stop in DPC_EXT class method where you will be able to see the values in internal table lt_client_headers.

jibin_joy
Contributor
0 Kudos

Hi,

Can i know ur Gateway SP Version

Regards,

Jibin Joy

Former Member
0 Kudos

SP08