JAXWS-如何处理来自故障响应的标头

时间:2018-10-01 12:51:39

标签: java web-services soap jax-ws

我将服务器编写为SAOP Web服务通信,它将此答案返回给客户端:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header>
      <ns3:responseInfo xmlns:ns3="http:/xxxxxxxxxxxxxxxx/wsdl/message/">
         <externalSessionId>?</externalSessionId>
         <externalReferenceNumber>?</externalReferenceNumber>
         <referenceNumber>12hslkhmku</referenceNumber>
         <executionTime>PT0.066S</executionTime>
      </ns3:responseInfo>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Client</faultcode>
         <faultstring>EchoFault</faultstring>
         <detail>
            <echoFault xmlns="http://xxxxxxxxxxxxxxxx/wsdl/message/"/>
         </detail>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这是我的客户端端口:

@WebMethod(operationName = "Echo", action = "http://xxxxxxxxxxx/soap/service/Echo")
    @WebResult(name = "echoResponse", targetNamespace = "http://xxxxxxxxxxx/wsdl/message/", partName = "echoResponse")
    public EchoResponse echo(
        @WebParam(name = "echoRequest", targetNamespace = "http://xxxxxxxxxxx/wsdl/message/", partName = "echoRequest")
        EchoRequest echoRequest,
        @WebParam(name = "requestInfo", targetNamespace = "http://xxxxxxxxxxx/wsdl/message/", header = true, partName = "requestInfoPart")
        RequestInfo requestInfoPart,
        @WebParam(name = "responseInfo", targetNamespace = "http://xxxxxxxxxxx/wsdl/message/", header = true, mode = WebParam.Mode.OUT, partName = "responseInfoPart")
        Holder<ResponseInfo> responseInfoPart)
        throws EchoFault_Exception
    ;

在这种情况下,responseInfoPart返回为null。如果响应不是故障,那么将填充responseInfoPart。您能帮我理解为什么在故障情况下标头未映射吗?

0 个答案:

没有答案