I\'m trying to build a client jar file to access a webservice. I\'m including the jar in a servlet/war that makes the client webservice calls. I\'m getting the following e
If all else fails, you can use reflection to override the delegate of the service.
QName qName = new QName(wsTargetNamespace, wsName);
service = new YourServiceScheduler(loc, qName);
Field delegateField = Service.class.getDeclaredField("delegate");
delegateField.setAccessible(true);
ServiceDelegate previousDelegate = (ServiceDelegate)delegateField.get(service);
if(!previousDelegate.getClass().getName().contains("cxf")) {
ServiceDelegate serviceDelegate = ((Provider) Class.forName("org.apache.cxf.jaxws.spi.ProviderImpl").newInstance())
.createServiceDelegate(loc, qName, service.getClass());
log.info("The " + getClass().getSimpleName() + " delegate is changed from " + "[" + previousDelegate + "] to [" +
serviceDelegate +
"]");
delegateField.set(service, serviceDelegate);
}
port = service.getYourServiceSoap();