axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hodgeman, Robert (LNG-DAY)" <>
Subject Explicit SOAP headers and WSDL2Java
Date Thu, 01 Apr 2004 18:58:26 GMT
I've done extensive searching on this subject, turning up a lot of questions
but few answers.  Most of the questions/answers were regarding implicit
headers and WSDL2Java's failure to support them (in the past, I understand
that they are supported now).

I have an operation defined in my wsdl that requires a header element in the
request message (for a service I provide).  I understand how to get my
handler to extract and interpret the header element, but am unable to find
any trace of the header element in my WSDL2Java generated stubs.  There is a
statement on one of the axis pages on that "The WSDL2Java
generation tool will recognize these [explicit] headers in most cases and
emit stub classes that include the headers are arguments to the methods."
Obviously a client can use the Stub interface to insert an arbitrary header,
but that sort of defeats the purpose of having the definition in the WSDL.

I am not finding this to be the case, and suspect that I do not have my WSDL
defined entirely properly.  Here is a snippet of WSDL that shows what I
have, I'm hoping someone can shed some light on the problem.  I am using
Axis 1.1 final's WSDL2Java tool:

First, the schema that defines the header I want to use is imported:
    <schema xmlns="">
        <import namespace=""
schemaLocation="Security.xsd" />

Next, I define the header message and part I'm trying to use:
<message name="MyAppHeaders">
    <part name="SecurityToken" element="security:SecurityToken" />

The portType is specified, just showing the input and output body elements
(defined/imported in the same file, but omitted here as irrelevant):
<portType name="MyPort">
    <operation name="MyOperation">
        <input message="tns:MyInputMessage"/>
        <output message="tns:MyOutputMessage"/>

Later, I define my binding, specifying the header element I want to use:
<binding name="MySoapBinding" type="tns:myPort">
    <operation name="MyOperation">
        <soap:operation soapAction="MyOperation_v1"/>
            <soap:header use="literal" message="tns:MyAppHeaders"
            <soap:body use="literal">
            <soap:body use="literal">

My understanding is that headers defined explicitly in the WSDL in this
manner should show up somewhere in the genereated stubs.  Is that not the
case?  My goal here is obviously to include the header information in the
WSDL to allow the WSDL to describe the header element that is expected, as
opposed to the client just having to "know" that it is expecting a header

Thanks very much in advance for any advice.  I'm hoping that I included
enough detail here that someone will be able to at least tell me if I'm
completely off base with my expectations or if it's just an error in the
wsdl on my part.


View raw message