我正在尝试从 wsdl 文件生成 java 类。最初,此文件与 Axis 1.1 一起使用,没有任何问题。然后 Axis1 被 Axis2 替换,现在生成无法处理以下错误:
[java] Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerat
ionException:在 org.apache.axis2.wsdl.codegen.CodeGenerationEngine.(Cod eGenerationEngine.java:175) [java] 在 org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35) 解析 WSDL [java] 时出错) [java] at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24) [java] 原因:org.apache.axis2.AxisFault:没有错误消息的部分:{http:// www.w3.org/2001/XMLSchema}createPolicyCustomLSPDTOFault [java] at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) [java] at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.popul ateService(WSDL11ToAxisServiceBuilder. java:411) [java] 在 org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.p opulateAllServices(WSDL11ToAllAxisServicesBuilder.java:107) [java] 在 org.apache.axis2.wsdl.codegen。CodeGenerationEngine.(Cod eGenerationEngine.java:169) [java] ... 2 更多
wsdl 文件中的错误行:
<wsdl:operation name="createPolicyCustomLSPDTO">
<wsdl:input message="tns:createPolicyCustomLSPDTORequest"/>
<wsdl:output message="tns:createPolicyCustomLSPDTOResponse"/>
<wsdl:fault name="Fault" message="tns:createPolicyCustomLSPDTOFault"/>
</wsdl:operation>
createPolicyCustomLSPDTOFault 定义如下
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://webservice.example.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:hql="http://hql.webservice.example.com"
targetNamespace="http://webservice.example.com"
>
<wsdl:types>
<xsd:import namespace="http://webservice.example.com" schemaLocation="ServerMessageDTO.xsd"/>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://webservice.example.com"
>
<xsd:element name="createPolicyCustomLSPDTOFault" type="tns:ServerMessageDTO"/>
</xsd:schema>
</wsdl:types>
我该如何解决?