cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing soap header in web service deployable proxy

Former Member
0 Kudos

Hello,

I have generated a deployable web service proxy that calls a web service that requires specific elements in the soap header. Is there a way to access the soap header in a deployable proxy? Following is a sample of the soap request I need to generate.

<?xml version="1.0" encoding="utf-16"?>

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

<soap:Header>

<ReturnAuthMgmtServiceHeader xmlns="http://rpmww.intel.com">

<ConsumerApp>CIRS</ConsumerApp>

<Username>TESTUSER</Username>

<Password>TESTPWD</Password>

<GeoCode>ASMO</GeoCode>

</ReturnAuthMgmtServiceHeader>

</soap:Header>

<soap:Body>

<GetCustomerSalesOrgList xmlns="http://rpmww.intel.com">

<customerCode>0000544380</customerCode>

</GetCustomerSalesOrgList>

</soap:Body>

</soap:Envelope>

Any help will be greatly appreciated.

Regards,

Brian Vandehey

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Guru,

Thank you, this helped a lot. I plan to code a class that implements the javax.xml.rpc.Handler interface. In this class I will add the elements to the SOAP header. Do you know where I would specify which class implements the handler interface for the SAP J2EE engine (i.e. which descriptor file)? I can't seem to find this anywhere in the SAP documentation. The article provides an XML descriptor showing where the handler is specified, but this file appears to be Oracle specific.

Thanks again for your help.

Regards,

Brian

Former Member
0 Kudos

Hi Brain,

I feel we do have a small help available on SAP Help pages. Just refer to the following page for SOAP headers, it may help you,

http://help.sap.com/saphelp_erp2005/helpdata/en/bf/bc593b989c4f7298cef1ff430dd60f/content.htm

Best regards,

Guru.

Answers (2)

Answers (2)

Former Member
0 Kudos

Guru,

You are correct -- I missed that topic in the documentation. Using the SOAP Headers protocol worked great, and was simple to implement. Much easier than coding a jax-rpc handler. Thank you for your help with solving this problem.

Following are the lines of code that I used to populate the proprietary SOAP header element and add it to the request message.

// Get a reference to the SOAP headers protocol.

// Object "port" is the previously instansiated SEI.

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

// Create the class that serializes to the custom header

// elements, then populate the values.

ReturnAuthMgmtServiceHeader rpmhdr = new ReturnAuthMgmtServiceHeader();

rpmhdr.setConsumerApp("CIRS");

rpmhdr.setGeoCode("ASMO");

rpmhdr.setUsername("USERXXX");

rpmhdr.setPassword("PWDXXX");

// Add the element to the SOAP header

headers.setOutputHeader(new QName("http://rpmww.intel.com", "ReturnAuthMgmtServiceHeader"), rpmhdr);

-


Thanks again.

Regards,

Brian

Former Member
0 Kudos

Hi Brian,

You can use the javax.xml.soap.SOAPHeader object to access the headers of the SOAP envelope. A SOAPEnvelope object may contain zero or more headers. You need to read the response SOPA xml directly and use javax.xml.soap.SOAPHeader for your prpose. Refer to the following article for such an example,

http://www.oracle.com/technology/sample_code/tech/java/codesnippet/webservices/soapheader/index.html

Best regards,

Guru.