org.xml.sax.SAXException:操作描述缺少参数

时间:2018-01-05 03:36:10

标签: java web-services soap

我使用下面的Soap Message调用SOAP webservices:

"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<soapenv:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">
  <soapenv:Body>
    <login>
      <password>London</password>
      <role>M</role>
      <userName>Jon</userName>
    </login>
  </soapenv:Body>
</soapenv:Envelope>"

SOAPAction正在使用 &#34; https://www.banking-payments.net/banks/services/BankManagerService/login&#34;

但我收到这样的错误:

<soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
  <faultcode>soapenv:Server.userException</faultcode>
  <faultstring>org.xml.sax.SAXException: operation description is missing parameter description!</faultstring>
  <detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">ukdc2-pc-smw01.worldpay.local</ns1:hostname></detail>
</soapenv:Fault>

这是我的WSDL摘录&#34; login&#34;

element name="login">
  <complexType>
    <sequence>
      <element name="loginRequest" type="tns2:LoginRequest"/>
    </sequence>
  </complexType>
</element>

<complexType name="LoginRequest">
  <sequence>
    <element name="applicationType" nillable="true" type="xsd:string"/>
    <element name="mobileIdentificationNumber" nillable="true" type="xsd:string"/>
    <element name="password" nillable="true" type="xsd:string"/>
    <element name="role" nillable="true" type="xsd:string"/>
    <element name="userName" nillable="true" type="xsd:string"/>
    <element name="valid" type="xsd:boolean"/>
    <element name="versionID" nillable="true" type="xsd:string"/>
  </sequence>

  <wsdl:message name="loginRequest">
    <wsdl:part element="tns1:login" name="parameters"></wsdl:part>
  </wsdl:message>

  <wsdl:operation name="login">
    <wsdl:input message="impl:loginRequest" name="loginRequest"></wsdl:input>
  </wsdl:operation>

Note: Username, password and role are mandatory

有谁能告诉我这个错误可能是什么原因?

1 个答案:

答案 0 :(得分:0)

您需要在WebService Implementation类中为login()方法的所有参数提供所有值。 根据WSDL中的描述,您的SOAP请求消息应类似于以下内容:

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<soapenv:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" 
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">
<soapenv:Body>
<login>
  <applicationType>value</applicationType>
  <mobileIdentificationNumber>value</mobileIdentificationNumber>
  <password>London</password>
  <role>M</role>
  <userName>Jon</userName>
  <valid>true</valid>
  <versionID>1</versionID>
</login>
</soapenv:Body>
</soapenv:Envelope>