2015-01-26 4 views
1

SOAP WS로 이동하고 wsdl에서 JAXB를 사용하여 SOAP 메시지에 사용 된 객체를 생성하는 과정에서. 비누 오류 메시지의 세부 정보 필드에 사용자 지정 예외를 얻으려고 할 때 문제가 있습니다. 다음은 기존 오류 메시지가 반환되는 방식입니다 (FooException이 자세하게 포함됩니다).비누 오류 자세한 사용자 정의 예외

<env:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <env:Header/> 
    <env:Body> 
     <env:Fault> 
     <faultcode>env:Server</faultcode> 
     <faultstring>Service specific exception: com.test.FooException: Invalid authentication credentials. Please try again.</faultstring> 
     <detail> 
      <n1:FooException xsi:type="n1:FooException" xmlns:n1="java:com.test"> 
       <errorCode xsi:type="xsd:int">101</errorCode> 
       <errorReason xsi:type="xsd:string">InvalidUserCredentials:Invalid authentication credentials. Please try again</errorReason> 
      </n1:FooException> 
     </detail> 
     </env:Fault> 
    </env:Body> 
</env:Envelope> 

spring config xml 파일에 customer exceptionResolver bean 식별자를 설정했습니다.

<bean id="exceptionResolver" class="com.test.FacadeExceptionHandler"> 
     <property name="order" value="1"></property> 
     <property name="defaultFault" value="SERVER"/> 
     <property name="exceptionMappings"> 
      <value> com.test.FooException=SERVER,FaultMsg </value> 
     </property> 
    </bean> 

은 내가 FacadeExceptionHandler를 생성하고 호출지고 있습니다,하지만 난 오류 메시지에 대한 세부 사항 부분에 FooException을 얻는 방법을 알아낼 수 없습니다.

도움이 될 것입니다!

미리 도움 주셔서 감사합니다.

+0

'FooException' 구현을 보여줍니다. – kolossus

답변

0

나는 당신의 FacadeExceptionHandler 당신이 결함에 대한 세부 사항을 추가 한 후 customizeFault 방법 (doc)를 무시하고 있어야합니다 (이 매개 변수로 당신은 당신의 예외)에서 당신이 거의 모두를 얻을 생각합니다.

비누 오류 메시지를 처리하는이 사용자 정의 세부 사항이 항목에 자세히 설명되어 모든 : http://www.stevideter.com/2009/02/18/of-exceptionresolvers-and-xmlbeans/ 당신은 봄 WS SoapFault<detail> 요소 원인에 중첩 된 요소의 같은 깊이와 SOAP 클라이언트 오류로 돌아갈 수 없습니다

0

은의 목록이 의 목록은 SoapFaultDetailElement이지만 SoapFaultDetailElement은 String의 자세한 메시지입니다. 그래서 Spring WS에서 SOAP 결함의 최대 깊이는 이고 하나는입니다.

<SOAP-ENV:Fault> 
    <faultcode>SOAP-ENV:Client</faultcode> 
    <faultstring>Сообщение не соответствуют схеме сервиса СМЭВ.</faultstring> 
    <detail> 
     <InvalidContent xmlns="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/faults/1.1">cvc-complex-type.2.4.a: Invalid content was found starting with element 'ns:SenderProvidedRequestData1'. One of '{"urn://x-artefacts-smev-gov-ru/services/message-exchange/types/1.1":SenderProvidedRequestData}' is expected.</InvalidContent> 
     <InvalidContent xmlns="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/faults/1.1">cvc-complex-type.2.3: Element 'ns:CallerInformationSystemSignature' cannot have character [children], because the type's content type is element-only.</InvalidContent> 
     <InvalidContent xmlns="urn://x-artefacts-smev-gov-ru/services/message-exchange/types/faults/1.1">cvc-complex-type.2.4.b: The content of element 'ns:CallerInformationSystemSignature' is not complete. One of '{WC["http://www.w3.org/2000/09/xmldsig#"]}' is expected.</InvalidContent> 
    </detail> 
    </SOAP-ENV:Fault>