axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Lindauer ...@secure-net.de>
Subject Re: SOAP Header for .NET client
Date Tue, 24 Jun 2003 10:16:43 GMT
Samprathi, Subramani non Unisys wrote:
> I need to use both request and response headers.
> The generated WSDL with axis does not have any request/response header 
> information.
> Is there way to generate this ?  is there any command line options in 
> JAVA2WSDL utility that I am missing?

I don't know for sure (just an Axis-user myself), but I think there
are currently no mechanisms for automated Header-handling in Axis.
You would need a syntax to inform Axis of headers for methods,
like in .NET with that brackets, or perhaps in the deployment
descriptor. Only then Axis could know of which headers are required
in which operations and generate appropriate WSDL.

What I did is to manipulate the WSDL myself, using the same
handler that sets/reads the headers, implementing / overwriting
the generateWSDL-method therein.
There you can get and acces the WSDL:

   Document doc = (Document) msgContext.getProperty("WSDL");
   if (doc != null) // WSDL is there only in response-chain
   { ... full DOM access to WSDL-XML-document ...
   }

Of course you need to put in correct WSDL, then .NETs
proxy generator will not give errors. There are three
things you need to add:

1. Add the header data-type in the schema-definitions
    (wsdl:types) like this:

    <schema targetNamespace="..myTargetNamespace..">
     <complexType name="MyHeaderType">
      <sequence>
       <element maxOccurs="1" minOccurs="1" name="id" type="xsd:long"/>
      </sequence>
     </complexType>
    </schema>

    This is a complex type even for only one field, because only
    then .NET can automatically handle the headers.

2. Add a message definition like this:

    <wsdl:message name="MyHeader">
     <part name="myHeader" type="ns1:MyHeaderId"
           xmlns:ns1="..myTargetNamespace.."/>
    </wsdl:message>

3. In Bindings, for each operation where you need a header,
    include it like this:

    <wsdl:operation name="myOperation1">
     <wsdlsoap:operation soapAction=""/>
     <wsdl:input name="myOperation1Request">
      <wsdlsoap:body .../>
      <wsdlsoap:header
         encodingStyle="..." namespace="..."
         message="impl:MyHeader"
         part="myHeader" use="encoded"/>
     </wsdl:input>
     <wsdl:output name="myOperation1Response">
      <wsdlsoap:body .../>
     </wsdl:output>
    </wsdl:operation>


Hope that helps.

Of course, it would be a nice feature for the future of Axis
to support headers in WSDL.


-- 
Florian Lindauer


Mime
View raw message