応答が返される前に変換できるように、リゾルバーで通常のJava例外をキャッチできない理由を誰かに教えてもらえますか?ブレークポイントにぶつかることはありません。それが不可能な場合、どうすればよいですか?
SoapFaultMappingExceptionResolver
public class LisSoapFaultTranslatorExceptionResolver extends SoapFaultMappingExceptionResolver {
@Override
protected void customizeFault(Object endpoint, Exception ex, SoapFault fault) {
SoapFaultDetail detail = fault.addFaultDetail();
}
}
豆
<sws:annotation-driven />
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping" />
<bean id="exceptionResolver"
class="com.openclass.adapter.ws.resolvers.LisSoapFaultTranslatorExceptionResolver">
<property name="defaultFault" value="RECEIVER,Server error">
</property>
<property name="exceptionMappings">
<value>java.lang.Exception=SERVER,FaultMsg</value>
</property>
</bean>
エラーのある石鹸応答
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring xml:lang="en">java.lang.NullPointerException</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
ウェブサービス
@PayloadRoot(localPart="readCourseSectionRequest", namespace="http://www.imsglobal.org/services/lis/cmsv1p0/wsdl11/sync/imscms_v1p0")
@ResponsePayload
public ReadCourseSectionResponse readCourseSection(@RequestPayload ReadCourseSectionRequest request, MessageContext messageContext) {
// Throws error since courseService is null
ReadCourseSectionResponse openClassResponse = courseService.readCourseSection(request);
return new ReadCourseSectionResponse();
}