Being new with wsdl parsing, am facing challenge to generate java classes from it. WSDL received from client is non-editable fixed. There isnt any separate xsd, rather all xsd schemas are present in WSDL only.
Issues with my maven build -
[WARNING] src-resolve: Cannot resolve the name 'q1:Contact' to a(n) 'type definition' component.
line 26317 of file:/D:/clientwsdl.wsdl#types?schema18
[WARNING] src-resolve: Cannot resolve the name 'q6:Contact' to a(n) 'type definition' component.
line 26337 of file:/D:/clientwsdl.wsdl#types?schema18
[WARNING] src-resolve: Cannot resolve the name 'q12:Contact' to a(n) 'type definition' component.
line 26360 of file:/D:/clientedl.wsdl#types?schema18
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 15913 of file:/D:/clientwsdl.wsdl
[ERROR] (Related to above error) This is the other declaration.
line 15883 of file:/D:/clientwsdl.wsdl
My bindings.xml
<jaxb:bindings
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jaxb:extensionBindingPrefixes="xjc"
jaxb:version="2.0">
<!-- for warnings like - [WARNING] Simple type "EconomicSector" was not
mapped to Enum due to EnumMemberSizeCap limit. Facets count: 804, current
limit: 256. You can use customization attribute "typesafeEnumMaxMembers"
to extend the limit. -->
<jaxb:bindings>
<jaxb:globalBindings typesafeEnumMaxMembers="3000" />
</jaxb:bindings>
</jaxb:bindings>
If i update bindings.xml with following additional bindings,
<!-- for err like - [ERROR] Two declarations cause a collision in the ObjectFactory
class. -->
<jaxb:bindings scd="x-schema::tns"
xmlns:tns="http://clientdomain.com/v123/NilReport">
<jaxb:schemaBindings>
<jaxb:package name="com.clientdomain.v123.NilReport" />
</jaxb:schemaBindings>
<jaxb:bindings
node="/wsdl:definitions/wsdl:types/xs:schema/xs:complexType[@name='NilReportSummary']">
<jaxb:class name="CustomNilReportSummary" />
<!-- Map NilReportSummary to a different name //xs:complexType[@name='NilReportSummary']
//*[local-name()='xs:complexType' and @name='NilReportSummary'] -->
</jaxb:bindings>
</jaxb:bindings>
Then my maven error changes too below inspite of correct xpath -
[ERROR] XPath evaluation of "/wsdl:definitions/wsdl:types/xs:schema/xs:complexType[@name='NilReportSummary']" results in empty target node
line 35 of file:/D:/myinstalls/WS_eclipse/crif-test-wsdl-parse/src/main/java/bindings.xml
My pom.xml has only build details as -
<build>
<plugins>
<plugin>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3.2</version>
<!-- latest versions doesnt recognize bindings.xml-->
<executions>
<execution>
<id>generate-java-sources</id>
<phase>process-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<extension>true</extension>
<bindingFiles>
<bindingFile>
${project.basedir}/src/main/java/bindings.xml</bindingFile>
</bindingFiles>
<wsdlFiles>
<wsdlFile>
${project.basedir}/src/main/resources/clientwsdl.wsdl</wsdlFile>
</wsdlFiles>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Snippet from clientwsdl.wsdl causing build issues -
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://clientdomain.com/v123/NilReport" elementFormDefault="qualified" targetNamespace="http://clientdomain.com/v123/NilReport">
<xs:import namespace="http://clientdomain.com/v123/Search"/>
<xs:import namespace="http://clientdomain.com/v123/CustomReport"/>
<xs:complexType name="NilReport">
<xs:sequence>
<xs:element minOccurs="0" name="Records" nillable="true" type="tns:ArrayOfNilReportRecord"/>
<xs:element minOccurs="0" name="Summary" nillable="true" type="tns:NilReportSummary"/>
</xs:sequence>
</xs:complexType>
<xs:element name="NilReport" nillable="true" type="tns:NilReport"/>
<xs:complexType name="ArrayOfNilReportRecord">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="NilReportRecord" nillable="true" type="tns:NilReportRecord"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfNilReportRecord" nillable="true" type="tns:ArrayOfNilReportRecord"/>
<xs:complexType name="NilReportRecord">
<xs:sequence>
<xs:element minOccurs="0" name="DateOfInquiry" type="xs:dateTime"/>
<xs:element minOccurs="0" name="Product" nillable="true" type="xs:string"/>
<xs:element xmlns:q1="http://clientdomain.com/v123/Search" minOccurs="0" name="Reason" type="q1:InquiryReasonsNotSpecified"/>
<xs:element minOccurs="0" name="ReasonText" nillable="true" type="xs:string"/>
<xs:element xmlns:q2="http://clientdomain.com/v123/CustomReport" minOccurs="0" name="Sector" type="q2:Sector"/>
<xs:element minOccurs="0" name="Subscriber" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="NilReportRecord" nillable="true" type="tns:NilReportRecord"/>
<xs:complexType name="NilReportSummary">
<xs:sequence>
<xs:element minOccurs="0" name="NumberOfInquiriesLast12Months" type="xs:int"/>
<xs:element minOccurs="0" name="NumberOfInquiriesLast1Month" type="xs:int"/>
<xs:element minOccurs="0" name="NumberOfInquiriesLast24Months" type="xs:int"/>
<xs:element minOccurs="0" name="NumberOfInquiriesLast3Months" type="xs:int"/>
<xs:element minOccurs="0" name="NumberOfInquiriesLast6Months" type="xs:int"/>
</xs:sequence>
</xs:complexType>
<xs:element name="NilReportSummary" nillable="true" type="tns:NilReportSummary"/>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://clientdomain.com/v123/CustomReport/CurrentRelations" elementFormDefault="qualified" targetNamespace="http://clientdomain.com/v123/CustomReport/CurrentRelations">
<xs:import namespace="http://clientdomain.com/v123/CustomReport/CurrentRelations/ContRel"/>
<xs:import namespace="http://clientdomain.com/v123/CustomReport"/>
<xs:import namespace="http://creditinfo.com/CB5"/>
<xs:import namespace="http://clientdomain.com/v123/CustomReport/CurrentRelations/Inv"/>
<xs:import namespace="http://clientdomain.com/v123/CustomReport/CurrentRelations/RelPar"/>
<xs:complexType name="CurrentRelations">
<xs:sequence>
<xs:element minOccurs="0" name="ContractRelationList" nillable="true" type="tns:ArrayOfContractRelation"/>
<xs:element minOccurs="0" name="InvolvementList" nillable="true" type="tns:ArrayOfInvolvement"/>
<xs:element minOccurs="0" name="RelatedPartyList" nillable="true" type="tns:ArrayOfRelatedParty"/>
</xs:sequence>
</xs:complexType>
<xs:element name="CurrentRelations" nillable="true" type="tns:CurrentRelations"/>
<xs:complexType name="ArrayOfContractRelation">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="ContractRelation" nillable="true" type="tns:ContractRelation"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfContractRelation" nillable="true" type="tns:ArrayOfContractRelation"/>
<xs:complexType name="ContractRelation">
<xs:sequence>
<xs:element xmlns:q1="http://clientdomain.com/v123/CustomReport/CurrentRelations/ContRel" minOccurs="0" name="Contact" nillable="true" type="q1:Contact"/>
<xs:element minOccurs="0" name="FullName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="IDNumber" nillable="true" type="xs:string"/>
<xs:element xmlns:q2="http://clientdomain.com/v123/CustomReport" minOccurs="0" name="IDNumberType" type="q2:IDNumberTypeAll"/>
<xs:element minOccurs="0" name="IdScoreId" type="xs:long"/>
<xs:element xmlns:q3="http://clientdomain.com/v123/CustomReport/CurrentRelations/ContRel" minOccurs="0" name="MainAddress" nillable="true" type="q3:MainAddress"/>
<xs:element xmlns:q4="http://clientdomain.com/v123/CustomReport" minOccurs="0" name="RoleOfCustomer" type="q4:RoleOfCustomer"/>
<xs:element xmlns:q5="http://creditinfo.com/CB5" minOccurs="0" name="SubjectType" type="q5:SubjectType"/>
<xs:element minOccurs="0" name="ValidFrom" nillable="true" type="xs:dateTime"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ContractRelation" nillable="true" type="tns:ContractRelation"/>
<xs:complexType name="ArrayOfInvolvement">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Involvement" nillable="true" type="tns:Involvement"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfInvolvement" nillable="true" type="tns:ArrayOfInvolvement"/>
<xs:complexType name="Involvement">
<xs:sequence>
<xs:element xmlns:q6="http://clientdomain.com/v123/CustomReport/CurrentRelations/Inv" minOccurs="0" name="Contact" nillable="true" type="q6:Contact"/>
<xs:element minOccurs="0" name="FullName" nillable="true" type="xs:string"/>
<xs:element xmlns:q7="http://creditinfo.com/CB5" minOccurs="0" name="Gender" type="q7:Gender"/>
<xs:element minOccurs="0" name="IDNumber" nillable="true" type="xs:string"/>
<xs:element xmlns:q8="http://clientdomain.com/v123/CustomReport" minOccurs="0" name="IDNumberType" type="q8:IDNumberTypeAll"/>
<xs:element minOccurs="0" name="IdScoreId" type="xs:long"/>
<xs:element minOccurs="0" name="LTV" nillable="true" type="xs:decimal"/>
<xs:element xmlns:q9="http://clientdomain.com/v123/CustomReport/CurrentRelations/Inv" minOccurs="0" name="MainAddress" nillable="true" type="q9:MainAddress"/>
<xs:element minOccurs="0" name="OwnershipShare" nillable="true" type="xs:decimal"/>
<xs:element xmlns:q10="http://creditinfo.com/CB5" minOccurs="0" name="SubjectType" type="q10:SubjectType"/>
<xs:element xmlns:q11="http://clientdomain.com/v123/CustomReport" minOccurs="0" name="TypeOfRelation" type="q11:RelationType"/>
<xs:element minOccurs="0" name="ValidFrom" nillable="true" type="xs:dateTime"/>
</xs:sequence>
</xs:complexType>
<xs:element name="Involvement" nillable="true" type="tns:Involvement"/>
<xs:complexType name="ArrayOfRelatedParty">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="RelatedParty" nillable="true" type="tns:RelatedParty"/>
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfRelatedParty" nillable="true" type="tns:ArrayOfRelatedParty"/>
<xs:complexType name="RelatedParty">
<xs:sequence>
<xs:element xmlns:q12="http://clientdomain.com/v123/CustomReport/CurrentRelations/RelPar" minOccurs="0" name="Contact" nillable="true" type="q12:Contact"/>
<xs:element minOccurs="0" name="FullName" nillable="true" type="xs:string"/>
<xs:element xmlns:q13="http://creditinfo.com/CB5" minOccurs="0" name="Gender" type="q13:Gender"/>
<xs:element minOccurs="0" name="IDNumber" nillable="true" type="xs:string"/>
<xs:element xmlns:q14="http://clientdomain.com/v123/CustomReport" minOccurs="0" name="IDNumberType" type="q14:IDNumberTypeAll"/>
<xs:element minOccurs="0" name="IdScoreId" type="xs:long"/>
<xs:element minOccurs="0" name="LTV" nillable="true" type="xs:decimal"/>
<xs:element xmlns:q15="http://clientdomain.com/v123/CustomReport/CurrentRelations/RelPar" minOccurs="0" name="MainAddress" nillable="true" type="q15:MainAddress"/>
<xs:element minOccurs="0" name="OwnershipShare" nillable="true" type="xs:decimal"/>
<xs:element xmlns:q16="http://clientdomain.com/v123/CustomReport" minOccurs="0" name="SubjectStatus" type="q16:SubjectStatus"/>
<xs:element xmlns:q17="http://creditinfo.com/CB5" minOccurs="0" name="SubjectType" type="q17:SubjectType"/>
<xs:element xmlns:q18="http://clientdomain.com/v123/CustomReport" minOccurs="0" name="TypeOfRelation" type="q18:RelationType"/>
<xs:element minOccurs="0" name="ValidFrom" nillable="true" type="xs:dateTime"/>
</xs:sequence>
</xs:complexType>
<xs:element name="RelatedParty" nillable="true" type="tns:RelatedParty"/>
</xs:schema>
</wsdl:types>