axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "St-Germain, Sylvain" <Sylvain.StGerm...@cognos.com>
Subject RE: Soap header support with generated stubs...
Date Thu, 17 Oct 2002 13:07:10 GMT
See http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13618
Sylvain.

-----Original Message-----
From: Daniel Hägg [mailto:daniel.hagg@factum.se]
Sent: Thursday, October 17, 2002 2:53 AM
To: axis-user@xml.apache.org
Subject: Re: Soap header support with generated stubs...


Hi!
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 
headers
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 xxxLocator.java 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 
javax.xml.rpc.ServiceException
    {
      org.apache.axis.client.Call call =
        (org.apache.axis.client.Call) super.createCall();
      try
      {
        org.apache.axis.message.SOAPHeaderElement h =
          new org.apache.axis.message.SOAPHeaderElement(
          "my.namespace.se", "MyHeader");
        h.addTextNode(m_MyHeader);
        call.addHeader(h);
      }
      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.
>
>--Alex 
>

This message may contain privileged and/or confidential information.  If you
have received this e-mail in error or are not the intended recipient, you
may not use, copy, disseminate or distribute it; do not open any
attachments, delete it immediately from your system and notify the sender
promptly by e-mail that you have done so.  Thank you.

Mime
View raw message