Re: SOAP Headers

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Mon, 11 Jul 2005 12:00:45 -0700

you can use -f:explicitcontext switch to bind a header message part in
the WSDL to appear as a parameter in the generated service endpoint
interface method. JAXRPC runtime and generated code takes care of
serializing/de-serializing the SOAP Header to this generated parameter.

For exmample,

    <xsd:schema targetNamespace="urn:test:types"
        <xsd:element name="HeaderRequest" type="xsd:string"/>
        <xsd:element name="Request" type="xsd:string"/>
        <xsd:element name="Response" type="xsd:string"/>

<wsd:message name="HeaderRequest">
    <wsdl:part name="header" element="types:HeaderRequest"/>

<wsd:message name="Request">
    <wsdl:part name="request" element="types:Request"/>

<wsd:message name="Response">
    <wsdl:part name="response" element="types:Response"/>

<wsd:operation name="helloWorld">
    <wsdl:input message="tns:Request"/>
    <wsdl:output message="tns:Response"/>

<wsdl:binding name="TestBinding" type="tns:Test">
    <soap:binding style="document"
    <wsdl:operation name="helloWorld">
        <soap:body use="literal" />
          <soap:header message="tns:HeaderRequest" part="header"
        <soap:body use="literal"/>


when wscompile is run without -f:explicitcontext option, it will
generated this signature

public string helloWorld(String request) throws RemoteException;

with -f:explicitcontext, it will generate:

public string helloWorld(String request, String header) throws

Notice the header part appearing as the header parameter in helloWorld


Franciso Gavilan wrote:

>I've found some references in WebServices forums to the possibility to access SOAP headers in the server side code. It seems I must use the option -f:explicitcontext when server side stubs are generated. Could you be more explicit? Could you send me some example? Where can I find more information?
>Thanks a lot
>Francisco Gavilán
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Vivek Pandey
Web Services Standards and Technologies
Sun Microsystems Inc.