explicit header support is in nightly, but not the implicit (hopefully soon).

you can try explicit headers. you header will be a parameter in a rpc method.
declare headers in a <types><xsd:schema .. as types, not elements

something like this (not tested):

<message name="Header">
<part name="SearchCriteria" type="abc:SearchElement"/>
</message>

<portType name="test">
<operation name="Ping">
<input message="tns:Header"/>
</operation>
</portType>

<binding name="testbinding" type="tns:test">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<soap:operation soapAction=""/>
<input>
<soap:header message="tns:Header" part="SearchCriteria" use="literal"/>
<soap:body use="encoded" / >
</input>
</operation>

Sasha


On Monday, October 21, 2002, at 09:23 AM, Alex Huang wrote:

I'm a little lost in regarding to the fixes that will bring soap header
support in the generated stubs.

I downloaded the axis nightly build from 10/20. Replaced my 1.0 Axis
with these jar files and ran the wsdl2java. No header generation. The
options listed on the wsdl2java help page are not changed from before.
Any help on how I am suppose to run this utility?

I also wonder if it's my fault in that I'm not declaring headers
correctly. Here's what I have a header declaration. Please let me know
if I'm doing something incorrectly.

In the message section, I declare the following. Of course, all of the
types are declared in the types section.
<message name="Header">
<part name="SearchCriteria" element="abc:SearchElement"/>
<part name="Sync" element="abc:SyncElement"/>
<part name="PostURL" element="abc:PostUrlElement"/>
<part name="Actor" element="abc:ActorElement"/>
<part name="RetryParams" element="abc:RetryParamsElement"/>
</message>

In the bindings section, the binding is declared as style="rpc". For
each operation, as input, I have the soap header and soap body
declaration.
<operation name="Ping">
<soap:operation soapAction=""/>
<input>
<soap:header message="abc:Header"
use="encoded"
namespace="AbcApi"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
<soap:body use="encoded"
namespace="AbcApi"

<encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; />
</input>
<output>
<soap:body use="encoded"
namespace="OpmApi"

encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>

What am I doing wrong? Is it the header declaration?

--Alex

-----Original Message-----
From: St-Germain, Sylvain [mailto:Sylvain.StGermain@;cognos.com]
Sent: Thursday, October 17, 2002 6:07 AM
To: [EMAIL PROTECTED]
Subject: RE: Soap header support with generated stubs...


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: [EMAIL PROTECTED]
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.





Reply via email to