CXF 2.2.12: How to turn off schema validation on the client side

后端 未结 4 1648
后悔当初
后悔当初 2021-01-04 20:46

I would like to turn off schema validation for JAXB-bound messages. I am dealing with the client-side CXF code (WSDL first generation). I have tried using



        
相关标签:
4条回答
  • 2021-01-04 20:56

    @SchemaValidation(type = SchemaValidation.SchemaValidationType.NONE) put this annotation to your endpoint implementation class

    0 讨论(0)
  • 2021-01-04 21:04
    @SchemaValidation(type = SchemaValidation.SchemaValidationType.NONE)
    public EndpointImpl endpoint(Bus bus, DirectConnectService accountServiceEndpoint) {
      }
    

    put this validation in your endpoint configuration class

    0 讨论(0)
  • 2021-01-04 21:07

    To turn off the schema validation you should set the schema-validation-enabled property to false.

    According to documentation referred by you (CXF FAQ).

    To enable schema validation (all requests and responses will be validated against schema) set

    <entry key="schema-validation-enabled" value="true" />
    

    To disable schema validation (none of the requests nor responses will be validated against schema) do nothing cause it is the default behavior or set

    <entry key="schema-validation-enabled" value="false" />
    
    0 讨论(0)
  • 2021-01-04 21:13

    Or from the code as follows:

        Client client = ClientProxy.getClient(XYZSOAPEndPoint);
        HTTPConduit http = (HTTPConduit) client.getConduit();
        HTTPClientPolicy policy = new HTTPClientPolicy();
        policy.setAllowChunking(false);
        http.setClient(policy);
        ((BindingProvider)XYZSOAPEndPoint).getRequestContext().put("schema-validation-enabled",true);
    
    0 讨论(0)
提交回复
热议问题