CXF 2.2.12: How to disable client side schema validation

I would like to disable schema checking for JAXB related messages. I am dealing with client-side CXF code (first generation WSDL). I tried using

<jaxws:client name="{http://apache.org/hello_world_soap_http}SoapPort" createdFromAPI="true"> <jaxws:properties> <entry key="schema-validation-enabled" value="true" /> </jaxws:properties> </jaxws:client> 

Without success (see the CXF FAQ link). I find it difficult to find a programmatic way to configure this property. I also studied the CXF short circuit and access to the parser, unmarshaller, etc.

Thanks for your help.

+6
source share
2 answers

To disable schema validation, you must set the schema-validation-enabled property to false .

According to the documentation you mentioned ( CXF FAQ ).

To enable schema validation (all requests and responses will be checked for compliance with the schema), set

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

To disable schema validation (none of the requests and responses will be checked against the schema) do not call anything, because this behavior is by default or set

 <entry key="schema-validation-enabled" value="false" /> 
+5
source

Or from the code:

  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); 
+1
source

Source: https://habr.com/ru/post/899160/


All Articles