wsimport不会生成响应类

时间:2019-05-20 11:20:27

标签: java soap jax-ws wsimport

我有一个看起来像这样的wsdl:

<?xml version='1.0' encoding='UTF-8'?>
<s0:definitions name="ws" targetNamespace="http://dbwork3/Ws.wsdl" xmlns="" xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://www.w3.org/2001/XMLSchema" xmlns:s2="http://dbwork3/Ws.wsdl" xmlns:s3="http://schemas.xmlsoap.org/wsdl/soap/">
  <s0:types/>
  <s0:message name="Ws_checkentitlement">
    <s0:part name="jmbg" type="s1:string"/>
    <s0:part name="documentId" type="s1:string"/>
    <s0:part name="requestId" type="s1:string"/>
    <s0:part name="firstName" type="s1:string"/>
    <s0:part name="lastName" type="s1:string"/>
    <s0:part name="dateOfBirth" type="s1:dateTime"/>
    <s0:part name="code" type="s1:string"/>
    <s0:part name="message" type="s1:string"/>
    <s0:part name="data" type="s1:string"/>
  </s0:message>
  <s0:message name="Ws_checkentitlementResponse">
    <s0:part name="firstName" type="s1:string"/>
    <s0:part name="lastName" type="s1:string"/>
    <s0:part name="dateOfBirth" type="s1:dateTime"/>
    <s0:part name="code" type="s1:string"/>
    <s0:part name="message" type="s1:string"/>
    <s0:part name="data" type="s1:string"/>
  </s0:message>
  <s0:message name="Ws_submitrequest">
    <s0:part name="requestId" type="s1:string"/>
    <s0:part name="code" type="s1:string"/>
    <s0:part name="message" type="s1:string"/>
    <s0:part name="data" type="s1:string"/>
  </s0:message>
  <s0:message name="Ws_submitrequestResponse">
    <s0:part name="code" type="s1:string"/>
    <s0:part name="message" type="s1:string"/>
    <s0:part name="data" type="s1:string"/>
  </s0:message>
  <s0:portType name="ws">
    <s0:operation name="checkentitlement" parameterOrder="jmbg documentId requestId firstName lastName dateOfBirth code message data">
      <s0:input message="s2:Ws_checkentitlement"/>
      <s0:output message="s2:Ws_checkentitlementResponse"/>
    </s0:operation>
    <s0:operation name="submitrequest" parameterOrder="requestId code message data">
      <s0:input message="s2:Ws_submitrequest"/>
      <s0:output message="s2:Ws_submitrequestResponse"/>
    </s0:operation>
  </s0:portType>
  <s0:binding name="ws" type="s2:ws">
    <s3:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <s0:operation name="checkentitlement">
      <s3:operation soapAction="http://dbwork3/Ws.wsdl/checkentitlement"/>
      <s0:input>
        <s3:body namespace="http://dbwork3/Ws.wsdl" parts="jmbg documentId requestId firstName lastName dateOfBirth code message data" use="literal"/>
      </s0:input>
      <s0:output>
        <s3:body namespace="http://dbwork3/Ws.wsdl" parts="firstName lastName dateOfBirth code message data" use="literal"/>
      </s0:output>
    </s0:operation>
    <s0:operation name="submitrequest">
      <s3:operation soapAction="http://dbwork3/Ws.wsdl/submitrequest"/>
      <s0:input>
        <s3:body namespace="http://dbwork3/Ws.wsdl" parts="requestId code message data" use="literal"/>
      </s0:input>
      <s0:output>
        <s3:body namespace="http://dbwork3/Ws.wsdl" parts="code message data" use="literal"/>
      </s0:output>
    </s0:operation>
  </s0:binding>
  <s0:service name="ws">
    <s0:port binding="s2:ws" name="wsPort">
      <s3:address location="http://x.x.x.x:y/xxxxyyyy/wsPort"/>fo
    </s0:port>
  </s0:service>
</s0:definitions>

我使用wsimport生成客户端类。但是,不会生成响应类。这些方法返回void,它们应该在其中返回响应对象。

这是生成的submitRequest方法的示例:

@WebMethod(action = "http://dbwork3/Ws.wsdl/submitrequest")
    public void submitrequest(
        @WebParam(name = "requestId", partName = "requestId")
        String requestId,
        @WebParam(name = "code", mode = WebParam.Mode.INOUT, partName = "code")
        Holder<String> code,
        @WebParam(name = "message", mode = WebParam.Mode.INOUT, partName = "message")
        Holder<String> message,
        @WebParam(name = "data", mode = WebParam.Mode.INOUT, partName = "data")
        Holder<String> data);

}

当我看一下WSDL结构时,它看起来还不错。这些方法应返回指定的响应。我什至尝试手动创建响应对象,但出现错误(“无法将对象强制转换为Submitresponse”)。

0 个答案:

没有答案