You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Marlon Patrick <ma...@gmail.com> on 2018/07/24 14:15:38 UTC

Ignore Schema Validation

Hey guys!

I would like to ask your help on a question with Apache CXF in
imlementation of a JAX-WS client.

When I run the code below through a simple main method, using JDK 1.8, *there
is no* attempt to connect to the internet. The code simply reads the WSDL
that exists locally on my machine and produces the objects.

// Before the execution I block traffic to the remote service --- iptables
-A OUTPUT -d MY_SERVICE_REMOTE_IP -j DROP

MyService myService = new
MyService(MyService.class.getResource("/META-INF/MY_SERVICE_LOCAL_WSDL.xml"));

MyServicePort myServicePort = myService.getMyServiceWSPort();

However, when I run this same code in JBoss EAP 6.4, which uses Apache CXF
internally, there is an attempt to connect to the internet to read/validate
some schemas. In fact, MY_SERVICE_LOCAL_WSDL.xml has some remote schemas:

<xs:schema ...>
  <xs:import schemaLocation="http://myservice.com?xsd=MyServiceTypes.xsd"
.../>
  <xs:import schemaLocation="http://myservice.com?xsd=Erros.xsd" .../>
</xs:schema>

*I would like Apache CXF not to attempt to read / validate these schemas so
that no Internet connection was required to create this object, just like
the default JDK 1.8 implementation.*

I've already seen some suggestions for downloading all the files and
keeping them locally, maybe create a jax-ws-catalog.xml.

But what caught my attention is that the default implementation of JDK 1.8
did not need any of this, it simply creates the object without accessing
the internet and manages to make the service calls normally.

*It would be possible for Apache CXF to behave in the same way as the
default implementation of JDK 1.8?*

One more thing, if I remove this excerpt from WSDL (xs:schema) the default
implementation of JDK 1.8 continues to run smoothly, whereas Apache CXF
generates an error:
Caused by: org.apache.cxf.wsdl11.WSDLRuntimeException: Part myServiceMethod
defined as element which is not in the schema.