axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marc Gagnon" <Marc.Gag...@quebecemail.com>
Subject [Axis2] re: WSDL2Java does not handle xsd:include correctly
Date Fri, 14 Jul 2006 02:13:27 GMT
Thank you for the suggestions, Anne... But my most recent tests failed again:

I modified the WSDL like you suggested (see xml comments):

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:ota="http://www.opentravel.org/OTA/2003/05"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.opentravel.org/OTA/2003/05">
<!-- Import Interface Definition WSDL-->
<import namespace="http://www.opentravel.org/OTA/2003/05" location="OTA_VehResInterface.wsdl"/>
<!-- Define SOAP binding-->
<binding name="VehicleReservationBinding" type="ota:VehicleReservationPortType">
<!-- Use document style and not rpc-->
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="OTA_VehResRQ">
<!-- Use 'literal' to include OTA XML as-is-->
<soap:operation soapAction="CreateReservation" style="document"/>
<input>
<soap:body use="literal" />   <!-- removed the namespace -->
</input>
<output>
<soap:body use="literal" />   <!-- removed the namespace -->
</output>
</operation>
</binding>
<!-- Define SOAP interface with previously declared binding-->
<service name="OTAVehicleReservationService">
<port name="VehicleReservationPort" binding="ota:VehicleReservationBinding">
<!-- Replace "http://mydomain/myservicename" with actual service endpoint-->
<soap:address location="http://mydomain/myservicename"/>
</port>
</service>
</definitions>

And the other WSDL (types):

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ota="http://www.opentravel.org/OTA/2003/05"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.opentravel.org/OTA/2003/05"
name="VehReservationService">
	<!-- Define data types (import OTA schemas) -->

	<wsdl:types>

 <!-- added targetNamespace, replaced import by include -->

		<xs:schema targetNamespace="http://www.opentravel.org/OTA/2003/05">
			<xs:include schemaLocation="OTA_VehResRQ.xsd"/>
			<xs:include schemaLocation="OTA_VehResRS.xsd"/>
		</xs:schema>
	</wsdl:types>

	<!-- Define request and response messages-->
	<wsdl:message name="VehicleReservationRequest">
		<wsdl:part name="OTA_VehResRQ" element="ota:OTA_VehResRQ"/>
	</wsdl:message>
	<wsdl:message name="VehicleReservationResponse">
		<wsdl:part name="OTA_VehResRS" element="ota:OTA_VehResRS"/>
	</wsdl:message>
	<!-- Define operation and reference messages-->
	<wsdl:portType name="VehicleReservationPortType">
		<wsdl:operation name="OTA_VehResRQ">
			<wsdl:input message="ota:VehicleReservationRequest"/>
			<wsdl:output message="ota:VehicleReservationResponse"/>
		</wsdl:operation>
	</wsdl:portType>
</wsdl:definitions>


Same result:

Axis2 1.0: wsdl2java -uri vehicule.wsdl

Using AXIS2_HOME:   c:\JavaLib\axis2-std-1.0_bin
Using JAVA_HOME:    c:\Program Files\Java\jdk1.5.0_06
Retrieving document at 'OTA_VehResInterface.wsdl', relative to 'file:/C:/workspace/TestOTA/wsdl/'.
Retrieving schema at 'OTA_VehResRQ.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResInterface.wsdl'.
Retrieving schema at 'OTA_VehicleCommonTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResRQ.xsd'.
Retrieving schema at 'OTA_SimpleTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehicleCommonTypes.xsd'.
Retrieving schema at 'OTA_CommonTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehicleCommonTypes.xsd'.
Retrieving schema at 'OTA_SimpleTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_CommonTypes.xsd'.
Retrieving schema at 'OTA_AirCommonTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehicleCommonTypes.xsd'.
Retrieving schema at 'OTA_SimpleTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_AirCommonTypes.xsd'.
Retrieving schema at 'OTA_CommonTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_AirCommonTypes.xsd'.
Retrieving schema at 'OTA_CommonPrefs.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehicleCommonTypes.xsd'.
Retrieving schema at 'OTA_SimpleTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_CommonPrefs.xsd'.
Retrieving schema at 'OTA_CommonTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_CommonPrefs.xsd'.
Retrieving schema at 'OTA_SimpleTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResRQ.xsd'.
Retrieving schema at 'OTA_CommonTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResRQ.xsd'.
Retrieving schema at 'OTA_AirCommonTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResRQ.xsd'.
Retrieving schema at 'OTA_CommonPrefs.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResRQ.xsd'.
Retrieving schema at 'OTA_VehResRS.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResInterface.wsdl'.
Retrieving schema at 'OTA_VehicleCommonTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResRS.xsd'.
Retrieving schema at 'OTA_SimpleTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResRS.xsd'.
Retrieving schema at 'OTA_CommonTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResRS.xsd'.
Retrieving schema at 'OTA_AirCommonTypes.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResRS.xsd'.
Retrieving schema at 'OTA_CommonPrefs.xsd', relative to 'file:/C:/workspace/TestOTA/wsdl/OTA_VehResRS.xsd'.
log4j:WARN No appenders could be found for logger (org.apache.axis2.i18n.ProjectResourceBundle).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing
WSDL
	at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:94)
	at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:32)
	at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:21)
Caused by: org.apache.axis2.AxisFault: java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.NullPointerException; nested exception is: 
	java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
	at org.apache.axis2.description.WSDL2AxisServiceBuilder.populateService(WSDL2AxisServiceBuilder.java:243)
	at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:87)
	... 2 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.NullPointerException
	at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1916)
	at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1929)
	at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1752)
	at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:121)
	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:250)
	at org.apache.axis2.description.WSDL2AxisServiceBuilder.getXMLSchema(WSDL2AxisServiceBuilder.java:959)
	at org.apache.axis2.description.WSDL2AxisServiceBuilder.copyExtensibleElements(WSDL2AxisServiceBuilder.java:1067)
	at org.apache.axis2.description.WSDL2AxisServiceBuilder.populateService(WSDL2AxisServiceBuilder.java:221)
	... 3 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
	at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1916)
	at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1746)
	at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:121)
	at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:53)
	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:255)
	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:217)
	at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1911)
	... 10 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
	at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1916)
	at org.apache.ws.commons.schema.SchemaBuilder.handleInclude(SchemaBuilder.java:1746)
	at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:121)
	at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:53)
	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:255)
	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:217)
	at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1911)
	... 16 more
Caused by: java.lang.NullPointerException
	at org.apache.ws.commons.schema.SchemaBuilder.handleSimpleType(SchemaBuilder.java:343)
	at org.apache.ws.commons.schema.SchemaBuilder.handleSimpleType(SchemaBuilder.java:477)
	at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:104)
	at org.apache.ws.commons.schema.SchemaBuilder.build(SchemaBuilder.java:53)
	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:255)
	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:217)
	at org.apache.ws.commons.schema.SchemaBuilder.resolveXmlSchema(SchemaBuilder.java:1911)
	... 22 more

I do not understand why you suggested to use xsd include instead of import:
a) That suggest the original wsdl was wrong, however it comes directly from OTA and the imports
where right.
b) The include directive was used correctly

As for the soap:body modification, I agree. I searched in the W3C recommendations and found
the following:
---- citation from Web Services Description Language (WSDL) 1.1
W3C Note 15 March 2001 ---
3.5 soap:body
...
    * If the operation style is rpc each part is a parameter or a return value and appears
inside a wrapper element within the body (following Section 7.1 of the SOAP specification).
The wrapper element is named identically to the operation name and its namespace is the value
of the namespace attribute. Each message part (parameter) appears under the wrapper, represented
by an accessor named identically to the corresponding parameter of the call. Parts are arranged
in the same order as the parameters of the call.
    * If the operation style is document there are no additional wrappers, and the message
parts appear directly under the SOAP Body element. 
...
---

The mention saying that for operation style rpc the namespace is a parameter and the fact
that there no other documented usage for namespace in the case of style document convince
me that namespace is not appropriate for usage document.


I will retry with the most recent source from svn...

Any other suggestion?





_____________________________________________________________
Obtenez aussi votre adresse electronique gratuite de
Quebecemail.com http://www.quebecemail.com, un service gratuit et permanent.
Mime
View raw message