2017-11-14 2 views
0

나는 org.springframework.ws.soap.client.SoapFaultClientException 개체를 가지고있다. 로깅 목적으로 여기에 포함 된 세부 정보를 얻고 싶지만이를 수행하는 방법을 찾기가 어렵습니다.SoapFaultClientException : 세부 출력

exception.getFaultStringOrReason() 메소드는 기본적인 오류 메시지를 표시합니다. 그러나, 나는 그 물건의 잘못 된 세부 사항들에 담긴 세부 사항들을 얻을 필요가있다. SOAP 응답은 다음과 같습니다

<?xml version="1.0" encoding="UTF-8"?> 
<soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <faultcode>soap:Client</faultcode> 
    <faultstring>The values from the client failed to pass validation.</faultstring> 
    <detail> 
    <Errors> 
     <Error reason="Required on input."> 
     <ErrorLocation> 
      <Node level="1" name="MyElement"/> 
      <Node level="2" name="MyField"/> 
     </ErrorLocation> 
     <Parameters/> 
     <StackTrace/> 
     </Error> 
    </Errors> 
    </detail> 
</soap:Fault> 

내가 지금까지 org.springframework.ws.soap.SoapFaultDetailElement 객체의 수를 통해 반복으로있어하지만 세부 안에 포함되지 수 있습니다. 이 작업을 수행 할 수 있습니까?

덕분에 어떤 도움을

답변

1

에 대한 사전에이

} catch (SoapFaultClientException e) { 
log.error(e); 
SoapFaultDetail soapFaultDetail = e.getSoapFault().getFaultDetail(); 
SoapFaultDetailElement detailElementChild = (SoapFaultDetailElement) soapFaultDetail.getDetailEntries().next(); 
Source detailSource = detailElementChild.getSource(); 

try { 
    Object detail = (JAXBElement<SearchResponse>) getWebServiceTemplate().getUnmarshaller().unmarshal(detailSource); 
    // throw new SoapFaultWithDetailException(detail); 

} catch (IOException e1) { 
    throw new IllegalArgumentException("cannot unmarshal SOAP fault detail object: " + soapFaultDetail.getSource()); 
} 

}

+0

위의 SearchResponse 클래스 무엇을 비 정렬 화되고있어 그 일을해야합니까? – GarlicBread