Greetings everyone,

I want to get a reality check before entering a JIRA bug report.  Thanks go
out to the SOAPtest guys over at Parasoft for helping me realize this
problem - it was quite subtle.  In the following WSDL, I do the following:

BankService-DocLiteral.wsdl, target namespace:
http://webservices.bah.com/examples/docliteral/bank

...which imports...

BankService.xsd, target namespace:
http://webservices.bah.com/examples/docliteral/bank

...which imports...

BankTypes.xsd, target namespace:
http://webservices.bah.com/examples/docliteral/bank/types

Note that the Deposit element and DepositType type are defined in
BankTypes.xsd, under the target namespace
http://webservices.bah.com/examples/docliteral/bank/types.  The
DepositRequest element and DepositRequestType type are defined in
BankService.xsd under the target namespace
http://webservices.bah.com/examples/docliteral/bank, and DepositRequestType
then *references* the Deposit element for inclusion inside of a sequence.

At the end of the day I should have a "wrapper" element in namespace A with
a child element in namespace B, a la:

<soap:Envelope
   xmlns:bank="http://webservices.bah.com/examples/docliteral/bank";
   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";

xmlns:banktypes="http://webservices.bah.com/examples/docliteral/bank/types";
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
   <soap:Body>
      <bank:DepositRequest>
         <banktypes:Deposit>
            <banktypes:AccountNumber>100</banktypes:AccountNumber>
            <banktypes:Amount>100</banktypes:Amount>
         </banktypes:Deposit>
      </bank:DepositRequest>
   </soap:Body>
</soap:Envelope>

The problem is then in the Axis 1.2 beta emitted WSDL
(http://.../DocLiteralBankService?wsdl) for the service - it places the
DepositType type in the correct namespace
(http://webservices.bah.com/examples/docliteral/bank/types), but the Deposit
element itself is in the wrong namespace
(http://webservices.bah.com/examples/docliteral/bank).  This results in the
following:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
   xmlns:bank="http://webservices.bah.com/examples/docliteral/bank";
   xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";

xmlns:banktypes="http://webservices.bah.com/examples/docliteral/bank/types";
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
   <soap:Body>
      <bank:DepositRequest>
         <bank:Deposit>
            <banktypes:AccountNumber>100</banktypes:AccountNumber>
            <banktypes:Amount>100</banktypes:Amount>
         </bank:Deposit>
      </bank:DepositRequest>
   </soap:Body>
</soap:Envelope>

Which of course the generated WSDL2Java service impl does not expect, so it
throws:

org.xml.sax.SAXException: Invalid element in
com.bah.webservices.examples.docliteral.bank.DepositRequestType - Deposit

Any thoughts?  The WSDL2Java generated service is definitely expecting the
Deposit namespace to be in the
http://webservices.bah.com/examples/docliteral/bank/types namespace, making
me think the problem is only with the ?wsdl auto-emitting.  A workaround, of
course, is to use <wsdlFile> to manually return good WSDL, but hey - now's
the time to fix this, right?

Thoughts and comments are quite welcome.

Regards,
Jonathan Anderson
Booz Allen Hamilton
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://webservices.bah.com/examples/docliteral/bank"; xmlns="http://www.w3.org/2001/XMLSchema"; xmlns:bank="http://webservices.bah.com/examples/docliteral/bank"; xmlns:banktypes="http://webservices.bah.com/examples/docliteral/bank/types"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<import namespace="http://webservices.bah.com/examples/docliteral/bank/types"; schemaLocation="file:///C:\projects\webservice-examples\resources\BankTypes.xsd"/>
	<complexType name="DepositRequestType">
		<sequence>
			<element ref="banktypes:Deposit"/>
		</sequence>
	</complexType>
	<element name="DepositRequest" type="bank:DepositRequestType"/>
	<complexType name="DepositResponseType">
		<sequence>
			<element ref="banktypes:Confirmation"/>
		</sequence>
	</complexType>
	<element name="DepositResponse" type="bank:DepositResponseType"/>
</schema>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; xmlns:bank="http://webservices.bah.com/examples/docliteral/bank"; targetNamespace="http://webservices.bah.com/examples/docliteral/bank";>
	<types>
		<xs:schema>
			<xs:import namespace="http://webservices.bah.com/examples/docliteral/bank"; schemaLocation="file:///C:\projects\webservice-examples\resources\BankService.xsd"/>
		</xs:schema>
	</types>
	<message name="DepositRequestMessage">
		<part name="depositRequest" element="bank:DepositRequest"/>
	</message>
	<message name="DepositResponseMessage">
		<part name="depositResponse" element="bank:DepositResponse"/>
	</message>
	<portType name="BankServicePortType">
		<operation name="deposit">
			<input message="bank:DepositRequestMessage"/>
			<output message="bank:DepositResponseMessage"/>
		</operation>
	</portType>
	<binding name="BankServiceSoapBinding" type="bank:BankServicePortType">
		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
		<operation name="deposit">
			<soap:operation soapAction="deposit"/>
			<input>
				<soap:body use="literal"/>
			</input>
			<output>
				<soap:body use="literal"/>
			</output>
		</operation>
	</binding>
	<service name="BankService">
		<port name="BankService" binding="bank:BankServiceSoapBinding">
			<soap:address location="http://localhost:8001/samples-axis/services/DocLiteralBankService"/>
		</port>
	</service>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="http://webservices.bah.com/examples/docliteral/bank/types"; xmlns:banktypes="http://webservices.bah.com/examples/docliteral/bank/types"; xmlns="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<complexType name="DepositType">
		<sequence>
			<element name="AccountNumber" type="positiveInteger"/>
			<element name="Amount" type="positiveInteger"/>
		</sequence>
	</complexType>
	<element name="Deposit" type="banktypes:DepositType"/>
	<complexType name="ConfirmationType">
		<sequence>
			<element name="TransactionID" type="positiveInteger"/>
			<element name="CompletionDate" type="dateTime"/>
		</sequence>
	</complexType>
	<element name="Confirmation" type="banktypes:ConfirmationType"/>
</schema>
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://webservices.bah.com/examples/docliteral/bank"; xmlns:apachesoap="http://xml.apache.org/xml-soap"; xmlns:impl="http://webservices.bah.com/examples/docliteral/bank"; xmlns:intf="http://webservices.bah.com/examples/docliteral/bank"; xmlns:tns1="http://webservices.bah.com/examples/docliteral/bank/types"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
	<!--WSDL created by Apache Axis version: 1.2beta
Built on Apr 19, 2004 (01:53:00 EDT)-->
	<wsdl:types>
		<schema elementFormDefault="qualified" targetNamespace="http://webservices.bah.com/examples/docliteral/bank/types"; xmlns="http://www.w3.org/2001/XMLSchema";>
			<complexType name="DepositType">
				<sequence>
					<element name="AccountNumber" nillable="true" type="xsd:positiveInteger"/>
					<element name="Amount" nillable="true" type="xsd:positiveInteger"/>
				</sequence>
			</complexType>
			<complexType name="ConfirmationType">
				<sequence>
					<element name="TransactionID" nillable="true" type="xsd:positiveInteger"/>
					<element name="CompletionDate" nillable="true" type="xsd:dateTime"/>
				</sequence>
			</complexType>
		</schema>
		<schema elementFormDefault="qualified" targetNamespace="http://webservices.bah.com/examples/docliteral/bank"; xmlns="http://www.w3.org/2001/XMLSchema";>
			<complexType name="DepositRequestType">
				<sequence>
					<element name="Deposit" nillable="true" type="tns1:DepositType"/>
				</sequence>
			</complexType>
			<element name="DepositRequest" type="impl:DepositRequestType"/>
			<complexType name="DepositResponseType">
				<sequence>
					<element name="Confirmation" nillable="true" type="tns1:ConfirmationType"/>
				</sequence>
			</complexType>
			<element name="DepositResponse" type="impl:DepositResponseType"/>
		</schema>
	</wsdl:types>
	<wsdl:message name="depositRequest">
		<wsdl:part element="impl:DepositRequest" name="DepositRequest"/>
	</wsdl:message>
	<wsdl:message name="depositResponse">
		<wsdl:part element="impl:DepositResponse" name="DepositResponse"/>
	</wsdl:message>
	<wsdl:portType name="BankServicePortType">
		<wsdl:operation name="deposit" parameterOrder="DepositRequest">
			<wsdl:input message="impl:depositRequest" name="depositRequest"/>
			<wsdl:output message="impl:depositResponse" name="depositResponse"/>
		</wsdl:operation>
	</wsdl:portType>
	<wsdl:binding name="BankServiceSoapBinding" type="impl:BankServicePortType">
		<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
		<wsdl:operation name="deposit">
			<wsdlsoap:operation soapAction=""/>
			<wsdl:input name="depositRequest">
				<wsdlsoap:body use="literal"/>
			</wsdl:input>
			<wsdl:output name="depositResponse">
				<wsdlsoap:body use="literal"/>
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:service name="BankService">
		<wsdl:port binding="impl:BankServiceSoapBinding" name="BankService">
			<wsdlsoap:address location="http://localhost:8001/samples-axis/services/DocLiteralBankService"/>
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>

Reply via email to