我正在尝试通过从https://gpcs.3m.com/Gpcs/ClaimProcessingService?wsdl使用wsimport解析WSDL文件来生成java客户端,但是无效。
我在Windows中使用JDK8。以下是详细信息。我正在使用JVM参数来解决像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)
我还在本地下载了WSDL文件,并通过删除一些引用来修改它,因为错误太多了。当我这样做时,我能够看到下面显示的错误消息的开头
[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
任何人都知道为什么这不能生成java代码?我也尝试使用Eclipse创建一个java客户端,但也失败了以下错误。提前谢谢。
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
答案 0 :(得分:0)
我得到它来生成客户端。 WSDL包含所有系统版本的版本。在WSDL URL中传递版本参数将为您提供特定版本。很明显,我在阅读他们的文档时错过了这一点。
我尝试传递此处提到的-B-XautoNameResolution的JVM参数How to use a class customization to resolve file generating conflicts 但那并没有奏效。我找到了一个在线WSDL验证网站,发现它缺少太多的XSD引用,这些引用都是系统的可用版本。这让我意识到我只需要为特定版本下载WSDL。