Hi,

For CXF, you can activate schema validation on the client side either using 
client XML configuration:
<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>

Or programmatically:
(BindingProvider)port).getRequestContext().put("schema-validation-enabled", 
"true");

Starting with CXF 2.3 you have the additional option of using the 
org.apache.cxf.annotations.SchemaValidation annotation.

However, I am not sure which JAX-WS implementation you currently use in your 
tomcat: CXF or JSE reference one.

Regards,
Andrei.

> -----Original Message-----
> From: rop [mailto:[email protected]]
> Sent: Dienstag, 29. April 2014 09:51
> To: [email protected]
> Subject: Enable SOAP schema-validation on client-side?
> 
> How do I enable SOAP schema-validation on the client-side (before sending the
> SOAP-request to the server)?
> 
> I'm calling a SOAP web-service from JEE6-client (running inside Tomcat-app),
> like:
> 
>       import javax.xml.ws.Service;
>       ...
>       Class<T> serviceClass;
>       ...
>       Service service = Service.create(url, new QName(namespaceURI,
> serviceName));
>       boolean inbound = true;
>       boolean outbound = true;
>       T servicePort = (T) service.getPort(serviceClass, new
> SchemaValidationFeature(inbound, outbound));
> 
> But doesn't seem to work... error is still thrown on the server-side if, for
> example, a mandatory value is missing.
> 
> Anything else I need to do to catch the error on client-side?

Reply via email to