bodtx bodtx - 3 months ago 36x
Java Question

Using JAX-WS stub even if Apache CXF is in dependency

WS client, it works when I call my WS
when I create my stub, I get an SEIStub impl.

Then here is a new client for another WS in Apache CXF. We put the dependency in our pom, then bad things happen:
When I call my first WS with my JAX-WS stub I get now a

, Apache CXF seems to become the default implmentation. and I cannot use my special header function that was done for WSBindingProvider instead of

Generation of client with jaxws:


the JAX-WS instanciation where the error is (on the cast)

xStub = new XWebServicesV21(url, qnameXWebServices);


generateHeader(aApplicationID, aUserId, (WSBindingProvider) xGetPort.get(), xUrl);

How to force JAXWS impl? I use JDK8 and Apache CXF 2.3.11 .


Sun's jaxws use, but CXF does not use it. org.apache.cxf.jaxws.JaxWsClientProxy implements

Therefore you can not cast xGetPort.get() to WSBindingProvider. In order to add soap headers with CXF in a similar way that WSBindingProvider.setOutboundHeaders check documentation or use CXF WS-Security support to generate the standard authentication headers for SOAP messages

If you want to use Sun's jaxws, make sure the jars are in the classpath before, or remove cxfjaxws dependencies.