I am sorry if I was not clear. The element hdr *is* a
parameter for the createToken. It is not a part of the
SOAP header block.
Actually here is a simpler example. Consider the
following WSDL fragment.
----------------
<s:element name="createToken">
<s:complexType>
<s:sequence>
<s:element name="hdr" type="s:string"
minOccurs="0"/>
<s:element name="tokenInput" type="s:string"
minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="createTokenResponse"
type="s:string"/>
<message name="createTokenSoapIn">
<part name="parameters"
element="s0:createToken"/>
</message>
<message name="createTokenSoapOut">
<part name="parameters"
element="s0:createTokenResponse"/>
/message>
<portType name="TokReqRespSoap">
<operation name="createToken">
<input message="s0:createTokenSoapIn"/>
<output message="s0:createTokenSoapOut"/>
</operation>
</portType>
-----------
I have defined a complex type named createToken that
constitures 2 strings. The response to the service
end-point is a string. I expect to get the generated
method createToken which will take one parameter of
type CreateToken which contains 2 string attributes -
hdr and tokenInput.
Instead, I get the following service end-point with 2
string parameters.
public java.lang.String createToken(
String createTokenHdr,
String createTokenTokenInput)
which is not what I want.
So, my question is: am I incorrectly specifying the
schema here? If so, how?
Thanks,
Shantanu
--- Anne Thomas Manes <[EMAIL PROTECTED]> wrote:
> Are you saying that the element "hdr" is not a
> parameter for the
> "createToken" operation? Perhaps you mean for it to
> be a SOAP Header block
> instead? If so, then you should not include this
> element in your wrapper
> element.
>
> You should define it thusly:
>
> <s:element name="createToken">
> <s:complexType>
> <s:sequence>
> <s:element name="tokenInput"
> type="tok:CreateTokenInput"
> minOccurs="0"/>
> </s:sequence>
> </s:complexType>
> </s:element>
> <s:element name="hdr" type="tok:Header"
> minOccurs="0"/>
>
> <message name="createTokenSoapIn">
> <part name="header" element="s0:hdr"/>
> <part name="parameters" element="s0:createToken"/>
> </message>
>
> And you need to add <s:header> element to your
> <binding> input message
> definition:
>
> <soap:header message="s0:createTokenSoapIn"
> part="header" use="literal"/>
>
> Note: when using WRAPPED style, there must be only
> one message part for the
> SOAP Body -- but you still need to define separate
> parts for each SOAP
> Header block.
>
> Anne
>
> -----Original Message-----
> From: Shantanu Sen [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 16, 2004 3:24 AM
> To: [EMAIL PROTECTED]
> Subject: question on wrapped mode
>
>
> I am enclosing a WSDL at the end of the mail. This
> is
> a typical doc-lit wrapped WSDL.
>
> Basically, the issue is with the following section
> of
> the WSDL
>
> <s:element name="createToken">
> <s:complexType>
> <s:sequence>
> <s:element name="hdr" type="tok:Header"
> minOccurs="0"/>
> <s:element name="tokenInput"
> type="tok:CreateTokenInput"
> minOccurs="0"/>
> </s:sequence>
> </s:complexType>
> </s:element>
>
> When the WSDL with the above section is used with
> WSDL2Java (both in Axis 1.1 and 1.2beta), the
> generated interface is as follows:
>
> public interface TokReqRespSoap extends
> java.rmi.Remote
> {
> public java.lang.String createToken(
> Header createTokenHdr,
> CreateTokenInput createTokenInput)
> throws java.rmi.RemoteException;
> }
>
> This is incorrect - it should have generated one
> parameter for the method createToken.
>
> Now, when I change that specific section of the WSDL
>
> as follows:
>
> <!--s:element name="createToken"-->
> <s:complexType name="createToken">
> <s:sequence>
> <s:element name="hdr" type="tok:Header"
> minOccurs="0"/>
> <s:element name="tokenInput"
> type="tok:CreateTokenInput"
> minOccurs="0"/>
> </s:sequence>
> </s:complexType>
> <!--/s:element-->
>
> Then, the generated interface is as follows:
>
> public interface TokReqRespSoap
> extends java.rmi.Remote {
> public java.lang.String createToken(
> CreateToken parameters)
> throws java.rmi.RemoteException;
> }
>
> This seems to be the correct interface based on the
> WSDL - a wrapped interface.
>
> Before I dig into the code to figure out why, I was
> wondering if anyone has any insight as to why the
> change in the schema produces this output. Is the
> section of the schema as shown in the first instance
> incorrect? If so why?
>
> Thanks,
> Shantanu
>
> PS. Here is the complete original WSDL
>
> -----------
> <?xml version="1.0" encoding="UTF-8"?>
> <definitions
> xmlns="http://schemas.xmlsoap.org/wsdl/"
> xmlns:s="http://www.w3.org/2001/XMLSchema"
> xmlns:s0="http://tokensvc.mycompany.com/token"
>
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>
>
targetNamespace="http://tokensvc.mycompany.com/token">
> <types>
> <s:schema elementFormDefault="qualified"
>
>
targetNamespace="http://tokensvc.mycompany.com/token"
> xmlns:s="http://www.w3.org/2001/XMLSchema"
>
> xmlns:tok="http://tokensvc.mycompany.com/token">
> <s:element name="createToken">
> <s:complexType>
> <s:sequence>
> <s:element name="hdr" type="tok:Header"
> minOccurs="0"/>
> <s:element name="tokenInput"
> type="tok:CreateTokenInput" minOccurs="0"/>
> </s:sequence>
> </s:complexType>
> </s:element>
> <s:element name="createTokenResponse"
> type="s:string"/>
> <s:complexType name="Header">
> <s:sequence>
> <s:element name="CallbackId"
> type="s:string" minOccurs="0"/>
> <s:element name="ClientId"
> type="s:string"
> minOccurs="0"/>
> </s:sequence>
> </s:complexType>
> <s:complexType name="CreateTokenInput">
> <s:sequence>
> <s:element name="ServiceID"
> type="s:string" minOccurs="0"/>
> <s:element name="AssignedPerson"
> type="s:string" minOccurs="0"/>
> </s:sequence>
> </s:complexType>
> </s:schema>
> </types>
>
> <message name="createTokenSoapIn">
> <part name="parameters"
> element="s0:createToken"/>
> </message>
> <message name="createTokenSoapOut">
> <part name="parameters"
> element="s0:createTokenResponse"/>
> </message>
> <portType name="TokReqRespSoap">
> <operation name="createToken">
> <input message="s0:createTokenSoapIn"/>
> <output message="s0:createTokenSoapOut"/>
> </operation>
> </portType>
> <binding name="TokReqRespSoap"
> type="s0:TokReqRespSoap">
> <soap:binding
> transport="http://schemas.xmlsoap.org/soap/http"
> style="document"/>
> <operation name="createToken">
> <soap:operation
>
soapAction="http://tokensvc.mycompany.com/token/createToken"
> style="document"/>
> <input>
> <soap:body use="literal"/>
> </input>
> <output>
> <soap:body use="literal"/>
>
=== message truncated ===