No able to generate java classed using wsimport command

Wednesday, July 17, 2013 7:47:53 AM
I found that Junit and TestNg libraries in download section are little outdated. So i thought to create Java classed from wsdl using wsimport command

but when i issue following command on cmd prompt i get following error

C:\Users\gulshan.saini\Desktop\New folder>wsimport -keep -verbose https://www.inflectra.com/SpiraDemo/Services/v3_0/ImportExport.svc?WSDL
parsing WSDL...


[WARNING] src-resolve.4.2: Error resolving component 'q1:RemoteAutomationHost'. It was detected that 'q1:RemoteAutomationHost' is in namespace 'http://s
hema document 'https://www.inflectra.com/SpiraDemo/Services/v3_0/ImportExport.svc?WSDL#types?schema1'. If this is the incorrect namespace, perhaps the p
://www.inflectra.com/SpiraDemo/Services/v3_0/ImportExport.svc?WSDL#types?schema1'.
  line 1 of https://www.inflectra.com/SpiraDemo/Services/v3_0/ImportExport.svc?WSDL#types?schema1

[WARNING] src-resolve.4.2: Error resolving component 'q96:ArrayOfint'. It was detected that 'q96:ArrayOfint' is in namespace 'http://schemas.microsoft.c
/Services/v3_0/ImportExport.svc?WSDL#types?schema1'. If this is the incorrect namespace, perhaps the prefix of 'q96:ArrayOfint' needs to be changed. If
vc?WSDL#types?schema1'.
  line 1 of https://www.inflectra.com/SpiraDemo/Services/v3_0/ImportExport.svc?WSDL#types?schema1

[WARNING] src-resolve.4.2: Error resolving component 'q216:ArrayOfint'. It was detected that 'q216:ArrayOfint' is in namespace 'http://schemas.microsoft
mo/Services/v3_0/ImportExport.svc?WSDL#types?schema4'. If this is the incorrect namespace, perhaps the prefix of 'q216:ArrayOfint' needs to be changed.
t.svc?WSDL#types?schema4'.
  line 137 of https://www.inflectra.com/SpiraDemo/Services/v3_0/ImportExport.svc?WSDL#types?schema4

[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 767 of https://www.inflectra.com/SpiraDemo/Services/v3_0/ImportExport.svc?WSDL

[ERROR] (Related to above error) This is the other declaration.
  line 734 of https://www.inflectra.com/SpiraDemo/Services/v3_0/ImportExport.svc?WSDL

[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 794 of https://www.inflectra.com/SpiraDemo/Services/v3_0/ImportExport.svc?WSDL

[ERROR] (Related to above error) This is the other declaration.
  line 751 of https://www.inflectra.com/SpiraDemo/Services/v3_0/ImportExport.svc?WSDL


Can anybody look into this issue or provide generated java classes?


Thanks & Regards
Gulshan
2 Replies
Wednesday, July 17, 2013 5:35:45 PM
Avatar
re: GulshanSaini on Wednesday, July 17, 2013 7:47:53 AM

Hi Gulshan

There is a known bug in JAX-WS that means we have to manually adjust the WSDL, do the wsimport and then revert the generated code afterwards.

However the good news is that we have precompiled Java classes already available. They can be downloaded from:

 

http://www.inflectra.com/Support/KnowledgeBase/KB49.aspx

Regards

Adam

Friday, August 2, 2013 7:15:32 PM
Avatar
re: inflectra.adam on Wednesday, July 17, 2013
Came across this problem myself yesterday, and not realizing these forums existed, I set about trying to fix it.

The solution I found uses an additional customization binding file. Here's what I provided additionally to wsimport:

<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  version="1.0">
  <jaxb:bindings schemaLocation="http://www.inflectra.com/SpiraDemo3/Services/v4_0/ImportExport.svc?wsdl#types?schema4">
    <jaxb:bindings node="xsd:complexType[@name='RemoteIncident']//xsd:element[@name='SeverityName']">
      <jaxb:factoryMethod name="TypeIncidentElementSeverityName"/>
    </jaxb:bindings>
    <jaxb:bindings node="xsd:complexType[@name='RemoteIncident']//xsd:element[@name='PriorityName']">
      <jaxb:factoryMethod name="TypeIncidentElementPriorityName"/>
    </jaxb:bindings>
    <jaxb:bindings node="xsd:complexType[@name='RemoteIncidentSeverity']//xsd:element[@name='Name']">
      <jaxb:factoryMethod name="TypeSeverityElementName"/>
    </jaxb:bindings>
    <jaxb:bindings node="xsd:complexType[@name='RemoteIncidentPriority']//xsd:element[@name='Name']">
      <jaxb:factoryMethod name="TypePriorityElementName"/>
    </jaxb:bindings>
  </jaxb:bindings>
</jaxb:bindings>

With that saved as binding.xml, I used this to generate the classes:

wsimport.exe http://www.inflectra.com/SpiraDemo3/Services/v4_0/ImportExport.svc?wsdl -bbinding.xml
Statistics
  • Started: Wednesday, July 17, 2013 7:47:53 AM
  • Last Reply: Friday, August 2, 2013 7:15:33 PM
  • Replies: 2
  • Views: 2528