I develop a module which use apache.cxf for a client webservices SOAP 1.2 (with authentification)
When I create the client connexion in the module client scope and use it, everything is OK.
public final static QName SERVICE_NAME = new QName("http://www.onvif.org/ver20/ptz/wsdl", "PTZService");
public final static QName PORT_NAME = new QName("http://www.onvif.org/ver20/ptz/wsdl", "PTZPort");
...
String user = "ONVIFClient1";
String password = "ONVIFClient1";
String endpointAddress = "http://10.60.21.10:580/onvif/ptz_service";
service = Service.create(SERVICE_NAME);
service.addPort(PORT_NAME, SOAPBinding.SOAP12HTTP_BINDING, endpointAddress);
port = service.getPort(PTZ.class);
client = ClientProxy.getClient(port); <======== EXCEPTION
endpoint = client.getEndpoint();
...
some code to add authentification in SOAP envelop
When I try to create the client connexion in the module gateway scope, with the same code, I have the following Exception :
(Note : both client and gateway are launched on the same machine)
java.lang.ClassCastException: com.sun.xml.internal.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy
at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:127)
Both client and gateway .pom have the dependency to common.pom which contain the right dependency to apache-cxf :
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>3.2.1</version>
</dependency>
Any Idea about the source of this exception ???
I doesn’t figure out why the behaviour is different in the client and the gateway scope.