Reputation: 11
I Cannot generate wsdl JAVA with wsimport for GetHotelMediaRQ. Could you please tell me how to resolve the problem?
wsimport -target 2.1 -keep -d /Users/jinli/Tmp/ws/classes -s . -p org.jellylab.soap.sacs.proto 'http://webservices.sabre.com/wsdl/sabreXML1.0.00/VCMP/GetHotelMediaRQ_v2.0.0.wsdl'
parsing WSDL...
[ERROR] 'HotelMediaInfos' is already defined
line 51 of http://webservices.sabre.com/wsdl/sabreXML1.0.00/VCMP/GetHotelMediaRS_v2.0.0.xsd
[ERROR] (related to above error) the first definition appears here
line 390 of http://webservices.sabre.com/wsdl/sabreXML1.0.00/VCMP/HotelMediaCommons_v2.0.0.xsd
Exception in thread "main" com.sun.tools.internal.ws.wscompile.AbortException
at com.sun.tools.internal.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:129)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2283)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:183)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:126)
at com.sun.tools.internal.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:429)
at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:190)
at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:159)
at com.sun.tools.internal.ws.WsImport.main(WsImport.java:42)
Upvotes: 0
Views: 346
Reputation: 1427
The error is correct, this was defined 2 times. You need to download the WSDL and all the associated schemas.
The GetHotelMediaRS_v2.0.0.xsd
looks like below xsd:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:stlp="http://services.sabre.com/STL_Payload/v02_02" xmlns="http://services.sabre.com/hotel/media/v2" targetNamespace="http://services.sabre.com/hotel/media/v2" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://services.sabre.com/STL_Payload/v02_02" schemaLocation="built-ins/STL2_Payload_v02_02.xsd" />
<xs:include schemaLocation="HotelMediaCommons_v2.0.0.xsd" />
<xs:element name="GetHotelMediaRS">
<xs:annotation>
<xs:documentation xml:lang="en">
Hotel Media Response Message provides hotel media content available for the specified hotel property code.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="stlp:STL_Response_Payload">
<xs:sequence>
<xs:element name="HotelMediaInfos" type="HotelMediaInfos">
<xs:annotation>
<xs:documentation xml:lang="en">
Contains information about one or more hotel codes and corresponding available media types.
This depends on the hotel codes provided in the request.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="HotelMediaInfos">
<xs:annotation>
<xs:documentation xml:lang="en">
Contains information about one or more hotel codes and corresponding available media types.
This depends on the hotel codes provided in the request.
</xs:documentation>
</xs:annotation>
<xs:sequence minOccurs="0" maxOccurs="50">
<xs:element name="HotelMediaInfo" type="HotelMediaInfo">
<xs:annotation>
<xs:documentation xml:lang="en">
Contains infroamtion about various media types available for a particular hotel code.
This depends on the hotel code provided in the request.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
You should simply remove the complexType
definition HotelMediaInfos
, and you would end up with something like the bellow xsd:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:stlp="http://services.sabre.com/STL_Payload/v02_02" xmlns="http://services.sabre.com/hotel/media/v2" targetNamespace="http://services.sabre.com/hotel/media/v2" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:import namespace="http://services.sabre.com/STL_Payload/v02_02" schemaLocation="built-ins/STL2_Payload_v02_02.xsd" />
<xs:include schemaLocation="HotelMediaCommons_v2.0.0.xsd" />
<xs:element name="GetHotelMediaRS">
<xs:annotation>
<xs:documentation xml:lang="en">
Hotel Media Response Message provides hotel media content available for the specified hotel property code.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:complexContent>
<xs:extension base="stlp:STL_Response_Payload">
<xs:sequence>
<xs:element name="HotelMediaInfos" type="HotelMediaInfos">
<xs:annotation>
<xs:documentation xml:lang="en">
Contains information about one or more hotel codes and corresponding available media types.
This depends on the hotel codes provided in the request.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:schema>
You can even replace the content above in the GetHotelMediaRS_v2.0.0.xsd
, and you should be able to compile.
Personal recommendation, in the future, try to do these things yourself. It will help you learn and avoid depending on Sabre or the community.
Upvotes: 1