【发布时间】:2016-12-28 13:36:05
【问题描述】:
我的 SOAP Web 服务之一的消费者无法读取 SOAP 错误(架构验证),因此他希望我们发送“Ok = false”响应而不是架构验证失败消息。
我不确定我们是否可以通过任何方式自定义拦截器来生成错误响应而不是 SOAP 错误。
截至今天,我正在使用拦截器生成故障,如下所示
@org.apache.cxf.interceptor.InInterceptors(interceptors = {"com.xxx.piano.services.interceptors.RequestParserInterceptor",
"com.xxx.piano.services.interceptors.RequestInterceptor"})
@SchemaValidation(type = SchemaValidation.SchemaValidationType.IN)
@org.apache.cxf.interceptor.OutFaultInterceptors(classes = RequestParsingValidator.class)
截至今天,我遇到了如下错误
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>[City is empty !] </faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
虽然我想要以下内容:
<ns3:XXXServiceTypeResponse>
<OK>false</OK>
<Error>
<Message>Duplicate Product Individual Identifier.</Message>
<TechnicalDescription>Postal Code Missing</TechnicalDescription>
<ErrorCode>E0022</ErrorCode>
</Error>
<ns3:ResponseID>01202662-0010-0001-0001-4617844469</ns3:ResponseID>
</ns3:XXXServiceTypeResponse>
请帮忙。
【问题讨论】:
标签: spring soap cxf interceptor spring-ws