axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Hägg <>
Subject Re: Soap header support with generated stubs...
Date Thu, 17 Oct 2002 06:52:44 GMT
As far as I know there is no way of adding soap headers to a WSDL 
generated client
in Axis 1.0 without modifiying the WSDL2Java generated code. :-(

If you are prepared to modify the generated code, I have found that soap 
can be added for all soap requests by overriding the createCall() method 
in the
xxxLocator class.

My solution looks like this:

// The following patch must be added to after it has
// been generated with WSDL2Java. This is necessary in order to compensate
// for the fact that WSDL2Java 1.0 does not support <soap:header>.

    public String m_MyHeader = new String("Default");

    public javax.xml.rpc.Call createCall() throws 
      org.apache.axis.client.Call call =
        (org.apache.axis.client.Call) super.createCall();
        org.apache.axis.message.SOAPHeaderElement h =
          new org.apache.axis.message.SOAPHeaderElement(
          "", "MyHeader");
      catch(javax.xml.soap.SOAPException ex)
        throw new javax.xml.rpc.ServiceException(ex.getMessage());
      return call;
// End of patch

/ Daniel

Alex Huang wrote:

>Hi all,
>I've been waiting anxiously for the release 1 of axis, hoping that it
>will bring soap header support in the generated client stubs.  But I
>couldn't find any such support in release 1.  Is there any plans for
>supporting this?  Did I miss anything?
>I've already written the server so that it can parse out the soap header
>itself.  That was fairly easy.  The problem is on the client side.
>I want to be able to give the wsdl file, axis, and the generated stubs
>to my clients and let them make a call much like a method call, instead
>of having to package up the call themselves.  I've even got so far as to
>write a class that the client can call to add arguments and generate a
>soap header.  All I need is a way to add that to the stubs class and say
>use this header.  Something like call.addHeader() in the generated stubs
>would be enough but I can't find anything like that.  
>I even tried to add that method manually to the stubs that wsdl-to-java
>generated but for some reason the soap message that is actually sent is
>still missing the soap header.
>I know axis is released now but, for my work, I can't release if one day
>I have to go back to my clients and say "you don't package the call now,
>just use the stubs generated by axis."  And packaging up the call is
>just very tedious for the client.  They end up learning a lot more about
>soap and axis than I want them to.
>Any help here?  Thanks in advance for any info, suggestions, dates for
>completion that you can provide.

View raw message