私はSpring-WSを初めて使用し、ゆっくりと頭を包み込みます。現在、既存のWSと通信するための単純なクライアントを作成しています。WebServiceTemplateメソッドとmarshalSendAndReceiveメソッドを使用しています。すべてが正常に動作します。
ただし、SOAP障害が発生すると、WSTはSoapFaultClientExceptionをスローします。独自のFaultMessageResolverを作成して、SOAP障害に含まれるものを確認できることに気付きました。ただし、FaultMessageResolverでWebServiceMessageをアンマーシャリングしようとすると、次のエラーメッセージが表示されます。
JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"http://schemas.xmlsoap.org/soap/envelope/", local:"Fault"). Expected elements are ....
明らかに、私のアンマーシャラーは適切に構成されていません。エラーをアンマーシャリングできるようにするには、xjcを使用して自分でJAXB障害モデルを生成する必要がありますか?これがまだ存在していないことに少し驚いています。
私のsoap:fault応答内からカスタムエラー情報を追加するためのより良い方法はありますか?エラーは次のようになり、serviceErrorsアイテムを抽出/アクセスしようとしています。
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Blaze Data Error</faultstring>
         <detail>
            <ns14:serviceErrors xmlns="http://www.nb.com/ClientServices/LendingSimulation/CalculateProfitabilityRequest" xmlns:ns13="http://www.nb.com/fw/errorMgmt" xmlns:ns14="http://www.nb.com/ClientServices/LendingSimulation/V1" >
               <ns13:faultstring>ServiceExecutionError</ns13:faultstring>
               <ns13:serviceError>
                  <ns13:errorCode>C10F1013</ns13:errorCode>
                  <ns13:errorType>B</ns13:errorType>
                  <ns13:errorMessage>Unable to retreive additional data</ns13:errorMessage>
                  <ns13:fieldName>Message error received from PHClient :  [An unexpected error code was received : system=PH context=[empty]]</ns13:fieldName>
                  <ns13:systemId>Calculator</ns13:systemId>
                  <ns13:time>2012-06-19 14:45:10.151-0400</ns13:time>
               </ns13:serviceError>
            </ns14:serviceErrors>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>
ありがとう!
エリック