Per the WSDL spec, the soap:header element [1] is constructed as follows:
<soap:header message="qname" part="nmtoken" use="literal|encoded"
encodingStyle="uri-list"? namespace="uri"?>*
The message="qname" and part="nmtoken" attributes refer to a message <part>
element [2], and you must define that message <part>.
<message name="nmtoken"> *
<part name="nmtoken" element="qname"? type="qname"?/> *
</message>
The wsdl:part requires either an element or a type attribute. If you were
sending a simple type, then you could just specify type="xsd:string" and use
SOAP encoding to format the header for you. But you want to send a complex
element, so you must define the element structure, which you do in the
<types> section.
[1] http://www.w3.org/TR/wsdl#_soap:header
[2] http://www.w3.org/TR/wsdl#_messages
Perhaps someone else can provide a WSDL4J code sample? (but I don't think
that WSDL4J provides a Schema API -- which is necessary for creating the
<types> section).
Anne
----- Original Message -----
From: "Steve Pannier" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 30, 2003 12:52 PM
Subject: Re: Adding header info to WSDL
> A couple questions:
>
> 1) Do you have any examples of doing this programmatically using the
WSDL4J
> API?
>
> 2) Why do I need to add stuff to the "types" and "part" sections of the
> WSDL? The spec only mentions
> the soap:header element in the binding input section when talking
> about Soap Header support.
>
> Regards.
>
> Steve Pannier
>
>
> ----- Original Message -----
> Yes.
> - define the <authentication> element in the <types> section.
> - define an additional <part> in your input message and reference the
> authentication element.
> - add a <soap:header> element to the <input> element in the <binding> and
> reference the header message part (see [1])
>
> [1] http://www.w3.org/TR/wsdl#_soap:header
>
> Anne
>
> ----- Original Message -----
> From: "Sam Khan" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 28, 2003 4:26 PM
> Subject: Adding header info to WSDL
>
>
> > Hi,
> >
> > Is it possible to specify header parameters in a web service's WSDL ?
> > Specifically, I want
> > to ensure that a client sends the following elements in a SOAP header:
> >
> > <authentication>
> > <username></username>
> > <password></password>
> > </authentication>
> >
> > Can this be enforced in the WSDL?
> >
> > Many thanks
> > Sam
> >
> >
>
>