cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP header

Former Member
0 Kudos

Hi ,

I have a requirement where i need to send some authentication details as the SOAP header and the actual data as the SOAP body.

<env:Header>

<AuthHeader>

<OemId>MyOemId</OemId>

<OemPassword>MyOemPassword</OemPassword>

<Domain>MyDomain</Domain>

<UserId>MyUserId</UserId>

<UserPassword>MyPassword</UserPassword>

</AuthHeader>

</env:Header>

<env:Body>

<MemberCreateRequest>

<Members>

<Member>

<AccountEnabled>true</AccountEnabled>

<Username>WillSmith</Username>

<Password>12345</Password>

<FirstName>Will</FirstName>

<LastName>Smith</LastName>

<Company>FreshPrince Industries</Company>

<TimeZoneId>k33abkkkk</TimeZoneId>

<RoleId>kk3bkkkkk</RoleId>

<OrganizationId>k3bnkkkkk</OrganizationId>

<ContactMethods>

<ContactMethod>

<ContactMethodEmail Label="home_email">

<Qualifier>home</Qualifier>

<Ordinal>0</Ordinal>

<EmailAddress></EmailAddress>

</ContactMethodEmail>

</ContactMethod>

</ContactMethods>

</Member>

</Members>

</MemberCreateRequest>

</env:Body>

How can i do that?

Please help me out with these.

Thanks,

kalyani.

Accepted Solutions (1)

Accepted Solutions (1)

vijay_b4
Active Contributor
0 Kudos

Hi Jyothsna,

The SOAP Headers Protocol

Definition

In some scenarios, the client may need to add SOAP headers to the request. This can be done using the SOAP headers protocol, which can be accessed by SOAP Web services. This protocol is not available to Web services with HTTP GET or POST bindings.

The SOAP headers protocol is a client runtime plugin located in com.sap.engine.services.webservices.jaxrpc.wsdl2java.features.builtin.SoapHeadersProtocol.

Use

To get an instance of the protocol, use:

SoapHeadersProtocol headers = (SoapHeadersProtocol) ((BaseGeneratedStub) client)._getGlobalProtocols().getProtocol("SoapHeadersProtocol");

Structure

The Service Endpoint Interface (SEI) is typecasted to BaseGeneratedStub, which exposes the internal plugin methods of the client:

com.sap.engine.services.webservices.jaxrpc.wsdl2java.BaseGeneratedStub

The basic methods of the SOAP headers protocol are as follows:

· headers.setOutputHeader(new Name("urn:myuri.com","myHeader"),value) – With this method you can pass, as a value, any schema-derived element type that is generated by the proxy generator for your client or generic DOM element.

Remember that all header elements must be namespace-qualified and, if you use a schema-derived value, it must be declared by the schema element as follows:

<xs:element name="myHeader" namespace="urn:myuri.com" type=”tns:myType”/>

· The methods for getting response headers are as follows:

¡ headers.getInputHeader(headerName:QName):Element – Returns the DOM element with the header content response

¡ headers.getInputHeader(headerName:QName,headerClass:Class):Object – Deserializes the schema-declared header in the response class

and once again the link http://help.sap.com/saphelp_nw04/helpdata/en/45/f957507cb343f78e818c50620ed5ca/frameset.htm

Reward points if this helps

Regards

Pragathi.

Answers (1)

Answers (1)

former_member859847
Active Contributor
0 Kudos

Hi,

The optional SOAP Header element contains application specific information (like authentication, payment, etc) about the SOAP message. If the Header element is present, it must be the first child element of the Envelope element.

and please check the following links.

http://www.w3schools.com/soap/soap_header.asp

http://www.xml.com/pub/a/2002/07/17/salz.html

http://java.sun.com/j2ee/1.4/docs/api/javax/xml/soap/SOAPHeader.html

regards

mahesh.