cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Custom SOAP header in the Sender soap scenario

Amitjadhav90
Explorer
0 Kudos

Hello Experts,

Currently i have a SOAP to RFC scenario . In which in the request parameter i have single input parameter. But as per the requirement we need to have some xml parameters in the soap header .

So i want the soap request looks like below,

<?xml version="1.0"?>

-<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

-<SOAP-ENV:Header>

-<ns0:TestHeader xmlns:ns0="http://testcustomer.com">

-<MessageDetails>

<ServiceType/>

<ServiceAction>String</ServiceAction>

<MessageRole rtype=""/>

-<MessageSource>

<SourceName/>

<SourceID idtype=""/>

</MessageSource>

-<MessageDestinations>

-<MessageDestination>

<DestinationID idtype=""/>

<DestinationName/>

</MessageDestination>

</MessageDestinations>

<Property Name=""/>

</MessageDetails>

</ns0:TestHeader>

</SOAP-ENV:Header>

-<SOAP-ENV:Body>

-<m:MT_CERT_IP xmlns:m="http://mydzit.gov.sa/zakat">

<INPUT1>102140000007</INPUT1>

</m:MT_CERT_IP>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Kindly let me know the steps, how can i achieve this ??

I have referred the AddSOAPHeaderBean  module but still not received the needed output.

Best Regards,

Amit

Accepted Solutions (0)

Answers (3)

Answers (3)

RaghuVamseedhar
Active Contributor
0 Kudos

Amit,

Please use XSLT mapping.

Check 2nd example in below video (at 10:00).

iaki_vila
Active Contributor
0 Kudos

Hi Amit,

My few cents.

You have an example in Dimitri Sannen's blog doing the mapping with XSLT.

Also, you have an other example like

Regards.

Former Member
0 Kudos

Amit,

Sender SOAP adapter by default strips the envelope and forwards the payload within the body. In your case you need to tick "Do not use SOAP Envelope" and "Keep Headers"  and build the Sender Interface datatype with  not just the single field , but with the entire soap structure , including the header  you mention above.  Then you should be able to access the header fields in your mapping .

https://scn.sap.com/thread/1501794

Amitjadhav90
Explorer
0 Kudos

Dev,

Thanks for your quick reply.

I have created the below request structure as per the link provided,

Is this correct way to do it ??

build the Sender Interface datatype with  not just the single field , but with the entire soap structure , including the header  you mention above.


You have mentioned this above line , how can i achieve this??

iaki_vila
Active Contributor
0 Kudos

Hi Amit,

You have like root tag MT_Header_req and you have to set only the SOAP structure.

Another way, it is to do my suggestion pointed out in Dimitri's blog. You can set a dummy interface, because with the XSLT you can generate your desired output directly or to use the XSLT to extract the desired fields and to create an intermediate message structure to do a message mapping.

Regards.

Former Member
0 Kudos

Do you have the WSDL ? You can try to create the XSD from the WSDL  by copying the content between <wsdl:types > to </wsdl:types> and  create the xsd in notepad . Look up the xsd specification online.

Or you could try and use xmlspy as it mentions here - http://scn.sap.com/thread/960832

Sorry dont have xmlspy, so cant verify .