0

I'm trying to generate a java client by parsing a WSDL file using wsimport from here https://gpcs.3m.com/Gpcs/ClaimProcessingService?wsdl but is not working.
I'm using JDK8 in Windows. Below are the details. I'm using a JVM argument to solve a problem like this WebService Client Generation Error with JDK8

C:\workspace\client\src>wsimport -J-Djavax.xml.accessExternalSchema=all -keep https://gpcs.3m.com/Gpcs/ClaimProcessingService?wsdl

[ERROR] Two declarations cause a collision in the ObjectFactory class.
  line 1899 of https://gpcs.3m.com/Gpcs/ClaimProcessingService?xsd=gpcs_standard_2016_3_0.xsd
[ERROR] (Related to above error) This is the other declaration.
  line 1899 of https://gpcs.3m.com/Gpcs/ClaimProcessingService?xsd=gpcs_standard_2016_3_1.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:498)
        at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:159)
        at com.sun.tools.internal.ws.WsImport.main(WsImport.java:42)

I also downloaded the WSDL file locally and modified it by removing some references because the errors were too many to see. When I did that I was able to see the beginning of the error messages shown below

    [ERROR] A class/interface with the same name "com._3m.gpcs.standard._2016_0.ClaimErrorType" is already in use. Use a class customization to resolve this conflict.
      line 3409 of https://gpcs.3m.com/Gpcs/ClaimProcessingService?xsd=gpcs_standard_2016_0_0.xsd
    [ERROR] (Relevant to above error) another "ClaimErrorType" is generated from here.
      line 3411 of https://gpcs.3m.com/Gpcs/ClaimProcessingService?xsd=gpcs_standard_2016_0_1.xsd
    [ERROR] A class/interface with the same name "com._3m.gpcs.standard._2016_0.ErrorSeverity" is a

lready in use. Use a class customization to resolve this conflict.
  line 3473 of https://gpcs.3m.com/Gpcs/ClaimProcessingService?xsd=gpcs_standard_2016_0_0.xsd

Anyone has any idea why this fails to generate java code? I also tried to create a java client by using Eclipse but that also fails with below error. Thanks in advance.

IWAB0399E Error in generating Java from WSDL:  java.io.IOException: WSDL2Java emitter timed out (this often means the WSDL at the specified URL is inaccessible)!
    java.io.IOException: WSDL2Java emitter timed out (this often means the WSDL at the specified URL is inaccessible)!
    at org.apache.axis.wsdl.gen.Parser.run(Parser.java:320)
    at org.apache.axis.wsdl.toJava.Emitter.run(Emitter.java:599)
    at org.eclipse.jst.ws.internal.axis.consumption.core.command.WSDL2JavaCommand.execute(WSDL2JavaCommand.java:207)
    at org.eclipse.jst.ws.internal.axis.consumption.ui.task.ClientCodeGenOperation$ClientWSModifyOperation.execute(ClientCodeGenOperation.java:144)
    at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:108)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2241)
    at org.eclipse.ui.actions.WorkspaceModifyOperation.run
Marquinio
  • 4,601
  • 13
  • 45
  • 68
  • It looks like you did everything correctly, and the WSDL simply has errors. I could be wrong about this, but I believe .Net happily tolerates these errors, which would suggest that the WSDL was written with only .Net in mind rather than compliance with the spec. – VGR Mar 01 '18 at 23:00

1 Answers1

0

I got it to generate client. The WSDL contains version for ALL the system versions. Passing a version parameter in the WSDL URL will give you a specific version. Clearly I somehow missed this when reading their documentation.

I tried passing a JVM argument of -B-XautoNameResolution that was mentioned here How to use a class customization to resolve file generating conflicts but that didn't work. The I found an online WSDL validation website and noticed it was missing too many XSD references, which were all available versions of system. This led me to realize that I just needed to download the WSDL for a specific version.

Marquinio
  • 4,601
  • 13
  • 45
  • 68