使用wsdl2java生成wsdl客户端时出错

时间:2016-05-26 04:10:34

标签: web-services wsdl axis2 wsdl2java

我正在尝试从wsdl生成一个Web服务客户端。我不确定WSDL有什么问题。任何帮助表示赞赏!... 以下是错误消息:

[echo] Generating jpl_farmersfinance's WSDL stub classes for WSDL 'client_1'.
     [java] Retrieving document at 'C:/ISH_Code/jpl_1134/source/jpl_farmersfinance/staticfiles/wsdl/getPaymentStatus.wsdl'.
     [java] Retrieving schema at 'getPaymentStatus.xsd', relative to 'file:/C:/ISH_Code/jpl_1134/source/jpl_farmersfinance/staticfiles/wsdl/getPaymentStatus.wsdl'.
     [java] Retrieving schema at 'Envelope.xsd', relative to 'file:/C:/ISH_Code/jpl_1134/source/jpl_farmersfinance/staticfiles/wsdl/getPaymentStatus.wsdl'.
     [java] Retrieving schema at 'ApplicationError.xsd', relative to 'file:/C:/ISH_Code/jpl_1134/source/jpl_farmersfinance/staticfiles/wsdl/getPaymentStatus.wsdl'.
     [java] [2016-05-26 14:00:24.001 EST] [main] INFO  o.a.a.xmlbeans.CodeGenerationUtility - Resolving schema with publicId [http://paymentsystem.fpf.co.nz/] and systemId [getPaymentStatus.xsd]
     [java] [2016-05-26 14:00:24.046 EST] [main] INFO  o.a.a.xmlbeans.CodeGenerationUtility - Resolving schema with publicId [http://schemas.xmlsoap.org/soap/envelope/] and systemId [Envelope.xsd]
     [java] [2016-05-26 14:00:24.065 EST] [main] INFO  o.a.a.xmlbeans.CodeGenerationUtility - Resolving schema with publicId [http://paymentsystem.fpf.co.nz/] and systemId [ApplicationError.xsd]
     [java] Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: Element QName is null for getPaymentStatus_ApplicationErrorMessage!
     [java]     at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:293)
     [java]     at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
     [java]     at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
     [java] Caused by: org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: Element QName is null for getPaymentStatus_ApplicationErrorMessage!
     [java]     at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:537)
     [java]     at org.apache.axis2.wsdl.codegen.CodeGenerationEngine.generate(CodeGenerationEngine.java:282)
     [java]     ... 2 more
     [java] Caused by: java.lang.RuntimeException: Element QName is null for getPaymentStatus_ApplicationErrorMessage!
     [java]     at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getFaultParamElements(AxisServiceBasedMultiLanguageEmitter.java:2925)
     [java]     at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.getFaultElement(AxisServiceBasedMultiLanguageEmitter.java:2844)
     [java]     at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.generateMethodElement(AxisServiceBasedMultiLanguageEmitter.java:2366)
     [java]     at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.loadOperations(AxisServiceBasedMultiLanguageEmitter.java:2242)
     [java]     at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.createDOMDocumentForCallbackHandler(AxisServiceBasedMultiLanguageEmitter.java:1232)
     [java]     at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.writeCallBackHandlers(AxisServiceBasedMultiLanguageEmitter.java:1198)
     [java]     at org.apache.axis2.wsdl.codegen.emitter.AxisServiceBasedMultiLanguageEmitter.emitStub(AxisServiceBasedMultiLanguageEmitter.java:460)
     [java]     ... 3 more

WSDL

<?xml version="1.0" encoding="UTF-8"?>
<WL5G3N0:definitions name="GetPaymentStatus" targetNamespace="http://paymentsystem.fpf.co.nz/" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://paymentsystem.fpf.co.nz/" xmlns:WL5G3N2="http://schemas.xmlsoap.org/soap/envelope/" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/">
  <WL5G3N0:documentation>rd_20141210_v3_bd_20141201_ltfo</WL5G3N0:documentation>
  <WL5G3N0:types>
    <xsd:schema xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://paymentsystem.fpf.co.nz/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsp1_3="http://paymentsystem.fpf.co.nz/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:import namespace="http://paymentsystem.fpf.co.nz/" schemaLocation="getPaymentStatus.xsd"/>
      <xsd:import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemaLocation="Envelope.xsd"/>
    </xsd:schema>
    <xsd:schema xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://paymentsystem.fpf.co.nz/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsp1_3="http://paymentsystem.fpf.co.nz/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <xsd:import namespace="http://paymentsystem.fpf.co.nz/" schemaLocation="ApplicationError.xsd"/>
    </xsd:schema>
  </WL5G3N0:types>
  <WL5G3N0:message name="getPaymentStatus">
    <WL5G3N0:part element="WL5G3N1:getPaymentStatus" name="parameters"/>
  </WL5G3N0:message>
  <WL5G3N0:message name="getPaymentStatusResponse">
    <WL5G3N0:part element="WL5G3N1:getPaymentStatusResponse" name="parameters"/>
  </WL5G3N0:message>
  <WL5G3N0:message name="getPaymentStatus_ApplicationErrorMessage">
    <WL5G3N0:part element="WL5G3N1:ApplicationError" name="fault_ApplicationError"/>
  </WL5G3N0:message>
  <WL5G3N0:message name="getPaymentStatus_SystemErrorMessage">
    <WL5G3N0:part element="WL5G3N1:SystemError" name="fault_SystemError"/>
  </WL5G3N0:message>
  <WL5G3N0:message name="getPaymentStatusFault">
    <WL5G3N0:part element="WL5G3N2:Fault" name="fault"/>
  </WL5G3N0:message>
  <WL5G3N0:portType name="PaymentStatusWS">
    <WL5G3N0:operation name="getPaymentStatus">
      <WL5G3N0:input message="WL5G3N1:getPaymentStatus"/>
      <WL5G3N0:output message="WL5G3N1:getPaymentStatusResponse"/>
      <WL5G3N0:fault message="WL5G3N1:getPaymentStatus_ApplicationErrorMessage" name="ApplicationError"/>
      <WL5G3N0:fault message="WL5G3N1:getPaymentStatus_SystemErrorMessage" name="SystemError"/>
      <WL5G3N0:fault message="WL5G3N1:getPaymentStatusFault" name="fault"/>
    </WL5G3N0:operation>
  </WL5G3N0:portType>
  <WL5G3N0:binding name="PaymentStatusWSPortBinding" type="WL5G3N1:PaymentStatusWS">
    <WL5G3N3:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <WL5G3N0:operation name="getPaymentStatus">
      <WL5G3N3:operation/>
      <WL5G3N0:input>
        <WL5G3N3:body use="literal"/>
      </WL5G3N0:input>
      <WL5G3N0:output>
        <WL5G3N3:body use="literal"/>
      </WL5G3N0:output>
      <WL5G3N0:fault name="fault">
        <WL5G3N3:fault name="fault" use="literal"/>
      </WL5G3N0:fault>
    </WL5G3N0:operation>
  </WL5G3N0:binding>
  <WL5G3N0:service name="PaymentStatusWS">
    <WL5G3N0:documentation>OSB Service</WL5G3N0:documentation>
    <WL5G3N0:port binding="WL5G3N1:PaymentStatusWSPortBinding" name="PaymentStatusWSPort">
      <WL5G3N3:address location="https://ltfotst.rfs.co.nz:443/API/FpfPaymentSystem/getPaymentStatus"/>
    </WL5G3N0:port>
  </WL5G3N0:service>
</WL5G3N0:definitions>

ApplicationError.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://paymentsystem.fpf.co.nz/" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://paymentsystem.fpf.co.nz/">
  <xsd:element name="ApplicationError" type="detail"/>
  <xsd:element name="SystemError" type="detail"/>
  <xsd:complexType name="detail">
    <xsd:sequence>
      <xsd:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
    </xsd:sequence>
    <xsd:anyAttribute namespace="##any" processContents="lax"/>
  </xsd:complexType>
</xsd:schema>

Envelope.xsd

<?xml version="1.0" encoding="UTF-8"?>

  <xs:element name="Envelope" type="tns:Envelope"/>
  <xs:complexType name="Envelope">
    <xs:sequence>
      <xs:element ref="tns:Header" minOccurs="0"/>
      <xs:element ref="tns:Body" minOccurs="1"/>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
    </xs:sequence>
    <xs:anyAttribute namespace="##other" processContents="lax"/>
  </xs:complexType>
  <xs:element name="Header" type="tns:Header"/>
  <xs:complexType name="Header">
    <xs:sequence>
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
    </xs:sequence>
    <xs:anyAttribute namespace="##other" processContents="lax"/>
  </xs:complexType>
  <xs:element name="Body" type="tns:Body"/>
  <xs:complexType name="Body">
    <xs:sequence>
      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
    </xs:sequence>
    <xs:anyAttribute namespace="##any" processContents="lax">
      <xs:annotation>
        <xs:documentation>Prose in the spec does not specify that attributes are allowed on the Body element</xs:documentation>
      </xs:annotation>
    </xs:anyAttribute>
  </xs:complexType>
  <!--Global Attributes.  The following attributes are intended to be usable via qualified attribute names on any complex type referencing them.-->
  <xs:attribute name="mustUnderstand">
    <xs:simpleType>
      <xs:restriction base="xs:boolean">
        <xs:pattern value="0|1"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="actor" type="xs:anyURI"/>
  <xs:simpleType name="encodingStyle">
    <xs:annotation>
      <xs:documentation>'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element.  For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification</xs:documentation>
    </xs:annotation>
    <xs:list itemType="xs:anyURI"/>
  </xs:simpleType>
  <xs:attribute name="encodingStyle" type="tns:encodingStyle"/>
  <xs:attributeGroup name="encodingStyle">
    <xs:attribute ref="tns:encodingStyle"/>
  </xs:attributeGroup>
  <xs:element name="Fault" type="tns:Fault"/>
  <xs:complexType name="Fault" final="extension">
    <xs:annotation>
      <xs:documentation>Fault reporting structure</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="faultcode" type="xs:QName"/>
      <xs:element name="faultstring" type="xs:string"/>
      <xs:element name="faultactor" type="xs:anyURI" minOccurs="0"/>
      <xs:element name="detail" type="tns:detail" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="detail">
    <xs:sequence>
      <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
    </xs:sequence>
    <xs:anyAttribute namespace="##any" processContents="lax"/>
  </xs:complexType>
</xs:schema>

getPaymentStatus.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://paymentsystem.fpf.co.nz/" xmlns:ns0="http://paymentsystem.fpf.co.nz/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:complexType name="Result">
    <xsd:sequence>
      <xsd:element name="resultCode" type="xsd:string"/>
      <xsd:element name="resultDesc" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="PaymentStatus">
    <xsd:sequence>
      <xsd:element name="statusCode" type="xsd:string"/>
      <xsd:element name="statusDesc" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="PaymentStatusRequest">
    <xsd:sequence>
      <xsd:element name="user_id" type="xsd:int"/>
      <xsd:element name="user_name" type="ns0:NotEmptyString"/>
      <xsd:element name="user_password" type="ns0:NotEmptyString"/>
      <xsd:element name="api_key" type="ns0:NotEmptyString"/>
      <xsd:element name="voucherNo" type="xsd:int"/>
      <xsd:element name="traceAuditNumber" type="ns0:NotEmptyString"/>
      <xsd:element name="transmissionDateTime">
        <xsd:simpleType>
          <xsd:restriction base="xsd:string">
            <xsd:pattern value="(2[0-9][0-9][0-9])(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])"/>
          </xsd:restriction>
        </xsd:simpleType>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="PaymentStatusResponse">
    <xsd:sequence>
      <xsd:element name="result" type="ns0:Result"/>
      <xsd:element name="paymentStatus" type="ns0:PaymentStatus" minOccurs="0"/>
      <xsd:element name="retrievalReferenceNumber" type="xsd:int" minOccurs="0"/>
      <xsd:element name="traceAuditNumber" type="xsd:string"/>
      <xsd:element name="transmissionDateTime" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>
  <xsd:simpleType name="NotEmptyString">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="(\s*[^\s]\s*)+"/>
    </xsd:restriction>
  </xsd:simpleType>
  <xsd:element name="getPaymentStatus" type="ns0:PaymentStatusRequest"/>
  <xsd:element name="getPaymentStatusResponse" type="ns0:PaymentStatusResponse"/>
</xsd:schema>

0 个答案:

没有答案