users@jax-rpc.java.net

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,

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

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

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

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

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

<wsdl:binding name="TestBinding" type="tns:Test">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="helloWorld">
      <wsdl:input>
        <soap:body use="literal" />
          <soap:header message="tns:HeaderRequest" part="header"
use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
</wsdl:binding>

...

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
RemoteException;

Notice the header part appearing as the header parameter in helloWorld
method.

-vivek.


Franciso Gavilan wrote:

>Hi
>
>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: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>
>

-- 
Vivek Pandey
Web Services Standards and Technologies
Sun Microsystems Inc.