You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by TMG <tm...@nc.rr.com> on 2004/12/11 15:45:48 UTC

WSDL - Missing something obvious w/ Header

I would like to add a header to several of my services to require some 
simple authorization (using CVS tree of Axis 1.2RC2).

An example of one of the service's wsdl binding is a follows:

    <wsdl:binding name="AccessControlSoapBinding" type="impl:AccessControl">
        <wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="setACL">
            <wsdlsoap:operation soapAction="urn:my:com:wsdl/setACL" 
style="document"/>
            <wsdl:input name="setACLInput" >
                <wsdlsoap:header message="impl:authorize" part="auth" 
use="literal" />
                <wsdlsoap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="setACLOutput">
                <wsdlsoap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

When using wsdl2java to generate the server and/or client stubs the 
deploy.wsdd has the correct type mapping for the authorization message 
and the __BindingStub.java has the serialization/deserialization 
methods, but the PROBLEM is that there is no header listed when the wsdl 
is queried on the deployed service (e.g. 
http://my.com/context/services/myservice?wsdl ).  Thus, there is no way 
for the client (consumer of service) to know that they need to create 
and pass a header.  That is, the wsdl returned shows the binding listed 
above, sans the header on the <input>.

I must be missing something obvious!

Thanks,

Tom Gordon

Re: WSDL - Missing something obvious w/ Header

Posted by TMG <tm...@nc.rr.com>.
Sathya,

Thank you for the info ... although it didn't solve the problem, it was 
good to know about that option ;).

I spent some time with the archives today and found some things that 
lead me to the right answer.

The bindings were fine, the problem was that I didn't include the header 
as a "part" in my message.  What I had incorrectly done instead, was 
create a separate message for the header.  That works with other wsdl 
parsers, but not Axis 1.2.

So to complete the thread for anybody else who has this problem, to get 
headers to show up in the wsdl (e.g. http://<service>?wsdl ), you have 
to do two things:
1.)  Create a message with two parts, one the header the other the body.
    <wsdl:message name="setACLInput">
        <wsdl:part name="auth" element="auth:authInfo"/>
        <wsdl:part name="parameters" element="xsd:string"/>
    </wsdl:message>
2.)  Allocate the parts in the binding's input method (as in previous 
e-mail)
   <wsdl:binding name="AccessControlSoapBinding" type="impl:AccessControl">
       <wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
       <wsdl:operation name="setACL">
           <wsdlsoap:operation soapAction="urn:my:com:wsdl/setACL" 
style="document"/>
           <wsdl:input>
               <wsdlsoap:header message="impl:setACLInput" part="auth" 
use="literal" />
               <wsdlsoap:body use="literal"/>
           </wsdl:input>
           <wsdl:output>
               <wsdlsoap:body use="literal"/>
           </wsdl:output>
       </wsdl:operation>
   </wsdl:binding>

Tom Gordon


Sathya Sankar wrote:

> Not sure why the generated WSDL is inconsistant but as a workaround 
> you can
> add a "<wsdlFile>" tag to the WSDD and point to your WSDL. I usually 
> do that to
> let my clients see the WSDL I coded, instead of an Axis generated one.
>
>
> */TMG <tm...@nc.rr.com>/* wrote:

snip...

Re: WSDL - Missing something obvious w/ Header

Posted by Sathya Sankar <sa...@yahoo.com>.
Not sure why the generated WSDL is inconsistant but as a workaround you can
add a "<wsdlFile>" tag to the WSDD and point to your WSDL. I usually do that to
let my clients see the WSDL I coded, instead of an Axis generated one.


TMG <tm...@nc.rr.com> wrote:

I would like to add a header to several of my services to require some 
simple authorization (using CVS tree of Axis 1.2RC2).

An example of one of the service's wsdl binding is a follows:


transport="http://schemas.xmlsoap.org/soap/http"/>

style="document"/>

use="literal" />








When using wsdl2java to generate the server and/or client stubs the 
deploy.wsdd has the correct type mapping for the authorization message 
and the __BindingStub.java has the serialization/deserialization 
methods, but the PROBLEM is that there is no header listed when the wsdl 
is queried on the deployed service (e.g. 
http://my.com/context/services/myservice?wsdl ). Thus, there is no way 
for the client (consumer of service) to know that they need to create 
and pass a header. That is, the wsdl returned shows the binding listed 
above, sans the header on the  [input] .

I must be missing something obvious!

Thanks,

Tom Gordon

		
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - You care about security. So do we.