‎2019 Jun 29 8:17 PM
Hi to all,
I need to insert http parameter to consumer proxy (SOAP).
With SOAP UI is possibile insert value into header tab.

I know that to REST webservice is used cl_http_client class to insert http value.
Anyone know how i can insert http header value with SOAP web service?
Regards
Giuseppe
‎2019 Jun 29 9:59 PM
After you instantiate the proxy class, you may add custom header fields via the methods GET_PROTOCOL and SET_SEND_HEADER_FIELDS as follows, before calling the Web Service:
DATA(transport) = CAST IF_WSPROTOCOL_TRANSPORT( proxy->GET_PROTOCOL( IF_WSPROTOCOL=>TRANSPORT ) ).
transport->set_send_header_fields( value #(
( name = 'Authorization' value = 'Bearer 81908CB' ) ) ).Standard header fields are automatically added by the SAP standard (Content-Type, Accept, SOAPAction, etc.)
‎2019 Jun 29 9:59 PM
After you instantiate the proxy class, you may add custom header fields via the methods GET_PROTOCOL and SET_SEND_HEADER_FIELDS as follows, before calling the Web Service:
DATA(transport) = CAST IF_WSPROTOCOL_TRANSPORT( proxy->GET_PROTOCOL( IF_WSPROTOCOL=>TRANSPORT ) ).
transport->set_send_header_fields( value #(
( name = 'Authorization' value = 'Bearer 81908CB' ) ) ).Standard header fields are automatically added by the SAP standard (Content-Type, Accept, SOAPAction, etc.)
‎2019 Jun 30 8:01 AM
‎2019 Jun 30 5:54 PM
Manciagli Giuseppe Can you tell the future visitors how you solved? (especially, if you added HTTP headers, how you did it) Thanks.
‎2019 Jun 30 12:23 AM
Hi Sandra, thanks for the reply.
In the IF_WSPROTOCOL interface I see only these protocols:
'IF_WSPROTOCOL_ASYNC_MESSAGING'
'IF_WSPROTOCOL_ROUTING'
'IF_WSPROTOCOL_ATTACHMENTS'
'IF_WSPROTOCOL_XI_HEADER'
'IF_WSPROTOCOL_WS_HEADER'
'IF_WSPROTOCOL_PAYLOAD'
'IF_WSPROTOCOL_MESSAGE_ID'
'IF_WSPROTOCOL_SESSION'
'IF_WSPROTOCOL_SEQUENCE'
'IF_WSPROTOCOL_SAP_ADDRESSING'
'IF_WSPROTOCOL_LUW_CONTROL'
'IF_WSPROTOCOL_CONNECTIVITY'
'IF_WSPROTOCOL_IBC
The only one that contains a method similar to the one you posted is the 'IF_WSPROTOCOL_WS_HEADER' but it is used to change the soap heade
I'm interested in changing the http header like SOAP UI in this way. Is there anything I didn't get?
Regard
Giuseppe

‎2019 Jun 30 7:24 AM - edited ‎2025 Jul 08 10:47 AM
Please refer to my comment attached to my previous answer.
‎2025 Jul 08 9:49 AM
Hi @Sandra_Rossi, I am referring the same code as yours but I am not able to see the custom http headers fields in integration suite. I am using SOAP based consumer web service. Is there any config. blocking the custom http header in SOAManager setting?
‎2025 Jul 08 10:49 AM
I don't know. You'd better start a new thread.
‎2019 Jul 01 8:00 AM
As an alternative, you could look at this link Consume SOAP Webservice and add custom Header
‎2019 Jul 01 9:35 PM
I think it refers to the SOAP header, not to the HTTP header.
‎2019 Jul 02 7:27 AM
I thought it was about the HTTP header because in the comments it indicates that in SOAMANAGER the transport protocol is set to Transfer via HTTP Header.
‎2021 Jan 22 4:01 PM
Hi all,
We have faced the same problem. Our release is 7.50 so IF_WSPROTOCOL_TRANSPORT doesn't exist. It has been solved with the following steps:
ENHANCEMENT 1 Z_SOAP_SET_HTTP_HEADERS. "active version
zcl_enh=>get_http_headers( IMPORTING ev_name = DATA(lv_name)
ev_value = DATA(lv_value) ).
IF lv_name IS NOT INITIAL.
entity->set_header_field( name = lv_name
value = lv_value ).
ENDIF.
ENDENHANCEMENT.
Hope it helps future visitors.
Regard,
Caner.
‎2021 Sep 07 12:29 PM
Hi Caner,
We are facing the same problem too. Has your issue been solved with the steps you've explained? If so, what is the code you've used to implement Zclass=>SET_HTTP_HEADERS & Zclass=>GET_HTTP_HEADERS?
‎2021 Sep 08 9:36 PM
Hi Nikhila,
Yes these steps are working well in our end. You should create setter and getter method for two private-static attributes (field and value) created in the step 2.
class ZCL_ENH definition
public
final
create public .
public section.
class-methods SET_HTTP_HEADERS
importing
!IV_NAME type STRING
!IV_VALUE type STRING .
class-methods GET_HTTP_HEADERS
exporting
!EV_NAME type STRING
!EV_VALUE type STRING .
protected section.
private section.
class-data FIELDNAME type STRING .
class-data FIELDVALUE type STRING .
ENDCLASS.
CLASS ZCL_ENH IMPLEMENTATION.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Static Public Method ZCL_ENH=>GET_HTTP_HEADERS
* +-------------------------------------------------------------------------------------------------+
* | [<---] EV_NAME TYPE STRING
* | [<---] EV_VALUE TYPE STRING
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD get_http_headers.
ev_name = fieldname.
ev_value = fieldvalue.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Static Public Method ZCL_ENH=>SET_HTTP_HEADERS
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_NAME TYPE STRING
* | [--->] IV_VALUE TYPE STRING
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD set_http_headers.
fieldname = iv_name.
fieldvalue = iv_value.
ENDMETHOD.
ENDCLASS.
Regard,
Caner.
‎2023 Dec 20 5:14 PM
Hi Giuseppe,
Did you can put the Authorization HTTP Header instead of SOAP Header?
Regards.
‎2023 Dec 20 10:12 PM
Please use the COMMENT button for comments, asking for complements, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.