cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CLOUD PLATFORM INTEGRATION - How to add SOAP HEADER?

VanessaHayakawa
Explorer
0 Kudos

Hello everyone! I'm new in SAP CPI and I need an urgent help.

I'm trying to create an integration between SAP ECC and another legacy environment called SOC. The communication should be throug SOAP and I need to insert a HEADER but I do not know how to do it. Can anybody help me? As I am new to CPI I need a step-by-step tutorial to understand.

So far I have configured what it shows in the images:

SAP - SENDER:

SOC - RECEIVER:

VanessaHayakawa
Explorer
0 Kudos

Thank you Vijay.

I've already seen this article but I could not understand how to build the script. I get the error below:

"Inbound processing in endpoint at https://www.soc.com.br/WSSoc/FuncionarioModelo2Ws failed with message "SoapFault:faultstring=An error was discovered processing the <wsse:Security> header.; faultcode={http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}InvalidSecurity"".

So I don't know if data values are incorrect or script's structure are (or both).

Accepted Solutions (0)

Answers (3)

Answers (3)

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Venessa,

Could you please share the XML which you are getting now without header also.

Regards,

Sriprasad Shivaram Bhat

VanessaHayakawa
Explorer
0 Kudos

Hello Sriprasad,

Of course. Here is the XML attached (it's a little big lol ).

funcionariomodelo2ws.txt

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Vanessa.

Could you please share input SOAP XML and expected SOAP XML with header.Will try to help you with code.

Usually this error can be avoided by using Message Mapping which makes sure there is no structural differences.

https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/459ccdf98a7542d897c1e802d0b...

Regards,

Sriprasad Shivaram Bhat

VanessaHayakawa
Explorer
0 Kudos

Hello Sriprasad,

Here is the code where I create the header in ABAP concatenating into a data:

<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsu:Timestamp wsu:Id="TS-' lv_timestamp_id '">
<wsu:Created> lv_created </wsu:Created>
<wsu:Expires> lv_expires </wsu:Expires>
</wsu:Timestamp>
<wsse:UsernameToken wsu:Id="UsernameToken-' lv_token_id '">
<wsse:Username> lv_username </wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest"> lv_sb64password </wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"> lv_b64nonce </wsse:Nonce>
<wsu:Created> lv_created </wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>

I put the values of these variables dynamically, but now I first want to set the header in a fixed way. I hope I was able to make myself clear.

And thank you for letting me know about the Message Mapping. I'm reading the guide...

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Vanesa,

You can use content modifier to set the header.Below will guide you

Click on the content modifier and navigate to Header tab like below to set the header.

Content Modifier-SAP HELP

Regards,

Sriprasad Shivaram Bhat

VanessaHayakawa
Explorer
0 Kudos

Thank you for your reply Sriprasad.

I've already tried with "Content Modifier" but occurs the error: "Error Details java.lang.IllegalArgumentException: The PayLoad elements cannot fit with the message parts of the BindingOperation. Please check the BindingOperation and PayLoadMessage".

Searching in some articles I saw the use of "Groovy Script" to set the header soap security. I do not know if is the best way but I'm doing several tests in here. Unfortunately I don't know the Groovy code and I made the soap header with xml only in the ABAP and SOAMANAGER...