验证错误中的披风“Spring-WS”

时间:2013-07-12 09:37:38

标签: java spring spring-ws

当发出SOAP请求并且验证失败时,我得到的响应是:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
         <faultcode>SOAP-ENV:Client</faultcode>
         <faultstring xml:lang="en">Validation error</faultstring>
         <detail>
            <spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">xyz-pattern-valid: Value '.....' is not facet-valid with respect to pattern '[0-9x]+' for type 'ABC'.</spring-ws:ValidationError>
         </detail>
      </SOAP-ENV:Fault>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

有没有办法摆脱各地的spring-ws显然暴露了底层的SOAP服务使用的是Spring和Java?

我已经考虑过扩展PayloadValidatingInterceptor,但是没有明显的方法来摆脱spring-ws标签。

1 个答案:

答案 0 :(得分:5)

想出来

public class ValidatingInterceptor extends PayloadValidatingInterceptor {
    @Override
    public QName getDetailElementName() {
        return new QName("http://www.mycee.co.za", "tech", "mt");
    }
}

WOOT!