cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP Header in SOAP Receiver adapter

Former Member
0 Kudos

Hi All,

I am doing a Proxy to Webservice scenario where webservice requires the SOAP request as below.

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">

<SOAP-ENV:Header>

<mh:CustomHeader xmlns:mh="http://schemas.test.com/customHeader">

<mh:MessageData>

<mh:MessageId>12345</mh:MessageId>

<mh:Timestamp>2004-06-09T14:41:44Z</mh:Timestamp>

</mh:MessageData>

</mh:CustomHeader>

<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext">

<wsse:UsernameToken>

<wsse:Username>test</wsse:Username>

<wsse:Password>test123</wsse:Password>

</wsse:UsernameToken>

</wsse:Security>

</SOAP-ENV:Header>

<SOAP-ENV:Body>

.......

</SOAP-ENV:Body>

Need your help to understand how can we achieve this using Standard SOAP adapter to customize the Header part as it requires to include "<mh:CustomHeader " & "UsernameToken".

Or Do i need to go for adapter module development to create this SOAP request.

Please provide your suggestion to achieve this scenario.

Thanks & regards

Ashwin

Edited by: ashwin dhakne on May 17, 2010 5:32 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Ashwin,

Need your help to understand how can we achieve this using Standard SOAP adapter to customize the Header part as it requires to include "<mh:CustomHeader " & "UsernameToken".

Or Do i need to go for adapter module development to create this SOAP request.

Use XSL Mapping for creating the SOAP header. You don't require custom adapter module for that.

Sample:-


<xsl:template match="/">
		<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

			<!-- Create the SOAP Header -->

			<soapenv:Header>
				<!-- Use User Name and Password-->
				<s:AuthenticationInfo xmlns:s="urn:XXX">
					<s:userName>User-Id</s:userName>
					<s:password>Password</s:password>
					<s:authentication/>
				</s:AuthenticationInfo>
			</soapenv:Header>

			<!-- Create the SOAP Body -->

			<soapenv:Body>
				<s:MI_xxx xmlns:s="urn:XXX">
					<s:Field1/>
					<s:Field2/>
				</s:MI_xxx>
			</soapenv:Body>
		</soapenv:Envelope>
	</xsl:template>

Regards,

Neetesh

stefan_grube
Active Contributor
0 Kudos

There are two options.

1. Use Axis adapter. Here you can specify username token

2. Create the SOAP header in mapping, check "do not use SOAP header" in channel.

Former Member
0 Kudos

Hi Stefan,

Thanks for your quick reply,

I have tried with the 2 option i.e creating SOAP Header in Message Mapping as below

<mh:CustomHeader xmlns:mh="http://schemas.test.com/customHeader">

<mh:MessageData>

<mh:MessageId>12345</mh:MessageId>

<mh:Timestamp>2004-06-09T14:41:44Z</mh:Timestamp>

</mh:MessageData>

</mh:CustomHeader>

<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/04/secext">

<wsse:UsernameToken>

<wsse:Username>test</wsse:Username>

<wsse:Password>test123</wsse:Password>

</wsse:UsernameToken>

</wsse:Security>

But it is throwing an error at receiver comm channel saying the unknown message type in the http://schemas.test.com/test definitions from the webservice.

Let me know if am doing anything wrong here

Thanks again

regards

Ashwin

stefan_grube
Active Contributor
0 Kudos

I recommend testing file -> http adapter to verify that the structure is correct and receiver accepts the message.

I assume the error message comes from server and the XML is not like expected.

Former Member
0 Kudos

Hi all,

Created a below target payload in a message mapping with SOAP Header & Body part as per the requirement.

In SOAP receiver communication channel, checked the option " Do Not Use SOAP Envelope".

But while executing an sceanrio, i am facing an error in SOAP receiver channel as Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Internal Server Error

And if i don't check the option " Do Not Use SOAP Envelope" it gives an error as

Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Unable to obtain service binding,error=Payload Envelope is not a known message for TestWebserviceService.

Please provide your suggestions to handle this issue.

<?xml version="1.0" encoding="UTF-8" ?>

<ns1:Envelope xmlns:ns1="http://schemas.test.com/CustomrHeader">

<ns1:Header>

<ns1:CustomrHeader>

<ns1:MessageData>

<ns1:MessageId>Constant</ns1:MessageId>

<ns1:Timestamp>Constant</ns1:Timestamp>

</ns1:MessageData>

<ns1:Security>

<ns1:UsernameToken>

<ns1:Username>Constant</ns1:Username>

<ns1:Password>Constant</ns1:Password>

</ns1:UsernameToken>

</ns1:Security>

</ns1:CustomrHeader>

</ns1:Header>

<ns1:Body>

<ns1:Details>

<ns1:Information>

<ns1:Title>Test</ns1:JobTitle>

</ns1:Information>

<ns1:Contacts>

<ns1:Street>Test Drive</ns1:Street />

</ns1:Contacts>

</ns1:Details>

</ns1:Body>

</ns1:Envelope>

Thanks

Ashwin

Edited by: ashwin dhakne on May 18, 2010 5:47 PM

Edited by: ashwin dhakne on May 18, 2010 5:48 PM

Edited by: ashwin dhakne on May 18, 2010 5:48 PM

stefan_grube
Active Contributor
0 Kudos

Your XML is not correct: This is not a SOAP message.

You cannot create a valid SOAP message with message mapping.

You have to use XSLT or Java mapping for this.