use of org.apache.cxf.jaxws.spi.WrapperClassLoader in project quarkus-cxf by quarkiverse.
the class CxfClientProducer method produceCxfClient.
/**
* The main workhorse producing a CXF client proxy.
*
* @param cxfClientInfo
* @return
*/
private Object produceCxfClient(CXFClientInfo cxfClientInfo) {
Class<?> seiClass;
try {
seiClass = Class.forName(cxfClientInfo.getSei(), false, Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
LOGGER.error("either webservice interface (client) or implementation (server) is mandatory");
return null;
}
QuarkusClientFactoryBean quarkusClientFactoryBean = new QuarkusClientFactoryBean(cxfClientInfo.getClassNames());
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(quarkusClientFactoryBean);
Bus bus = quarkusClientFactoryBean.getBus(true);
bus.setExtension(new WrapperHelperClassLoader(bus), WrapperHelperCreator.class);
bus.setExtension(new ExtensionClassLoader(bus), ExtensionClassCreator.class);
bus.setExtension(new ExceptionClassLoader(bus), ExceptionClassCreator.class);
bus.setExtension(new WrapperClassLoader(bus), WrapperClassCreator.class);
bus.setExtension(new FactoryClassLoader(bus), FactoryClassCreator.class);
bus.setExtension(new GeneratedNamespaceClassLoader(bus), NamespaceClassCreator.class);
factory.setServiceClass(seiClass);
LOGGER.debugf("using servicename {%s}%s", cxfClientInfo.getWsNamespace(), cxfClientInfo.getWsName());
factory.setServiceName(new QName(cxfClientInfo.getWsNamespace(), cxfClientInfo.getWsName()));
if (cxfClientInfo.getEpName() != null) {
factory.setEndpointName(new QName(cxfClientInfo.getEpNamespace(), cxfClientInfo.getEpName()));
}
factory.setAddress(cxfClientInfo.getEndpointAddress());
if (cxfClientInfo.getSoapBinding() != null) {
factory.setBindingId(cxfClientInfo.getSoapBinding());
}
if (cxfClientInfo.getWsdlUrl() != null && !cxfClientInfo.getWsdlUrl().isEmpty()) {
factory.setWsdlURL(cxfClientInfo.getWsdlUrl());
}
if (cxfClientInfo.getUsername() != null) {
factory.setUsername(cxfClientInfo.getUsername());
}
if (cxfClientInfo.getPassword() != null) {
factory.setPassword(cxfClientInfo.getPassword());
}
for (String feature : cxfClientInfo.getFeatures()) {
addToCols(feature, factory.getFeatures(), Feature.class);
}
for (String handler : cxfClientInfo.getHandlers()) {
addToCols(handler, factory.getHandlers(), Handler.class);
}
for (String inInterceptor : cxfClientInfo.getInInterceptors()) {
addToCols(inInterceptor, factory.getInInterceptors());
}
for (String outInterceptor : cxfClientInfo.getOutInterceptors()) {
addToCols(outInterceptor, factory.getOutInterceptors());
}
for (String outFaultInterceptor : cxfClientInfo.getOutFaultInterceptors()) {
addToCols(outFaultInterceptor, factory.getOutFaultInterceptors());
}
for (String inFaultInterceptor : cxfClientInfo.getInFaultInterceptors()) {
addToCols(inFaultInterceptor, factory.getInFaultInterceptors());
}
LOGGER.debug("cxf client loaded for " + cxfClientInfo.getSei());
return factory.create();
}
use of org.apache.cxf.jaxws.spi.WrapperClassLoader in project cxf by apache.
the class Client method main.
public static void main(String[] args) throws Exception {
if (args.length == 0) {
System.err.println("please provide wsdl");
System.exit(0);
}
final Bus bus = new ExtensionManagerBus();
BusFactory.setDefaultBus(bus);
bus.setExtension(new WrapperHelperClassLoader(bus), WrapperHelperCreator.class);
bus.setExtension(new ExtensionClassLoader(bus), ExtensionClassCreator.class);
bus.setExtension(new ExceptionClassLoader(bus), ExceptionClassCreator.class);
bus.setExtension(new WrapperClassLoader(bus), WrapperClassCreator.class);
bus.setExtension(new FactoryClassLoader(bus), FactoryClassCreator.class);
bus.setExtension(new GeneratedNamespaceClassLoader(bus), NamespaceClassCreator.class);
run(args, bus);
System.exit(0);
}
Aggregations