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"/>
</output>
</operation>
</binding>
<service name="TokReqResp">
<port name="TokReqRespSoap"
binding="s0:TokReqRespSoap">
<soap:address
location="http://localhost:8080/tokwebsvc/TokReqResp"/>
</port>
</service>
</definitions>
---------------