use of org.apache.cxf.binding.BindingFactoryManager in project cxf by apache.
the class WSDLServiceUtils method getBindingFactory.
public static BindingFactory getBindingFactory(Binding binding, Bus bus, StringBuilder sb) {
BindingFactory factory = null;
for (Object obj : binding.getExtensibilityElements()) {
if (obj instanceof ExtensibilityElement) {
ExtensibilityElement ext = (ExtensibilityElement) obj;
sb.delete(0, sb.length());
sb.append(ext.getElementType().getNamespaceURI());
try {
BindingFactoryManager manager = bus.getExtension(BindingFactoryManager.class);
if (manager != null) {
factory = manager.getBindingFactory(sb.toString());
}
} catch (BusException e) {
// ignore, we'll use a generic BindingInfo
}
if (factory != null) {
break;
}
}
}
return factory;
}
use of org.apache.cxf.binding.BindingFactoryManager in project cxf by apache.
the class ServiceWSDLBuilderTest method setupWSDL.
private void setupWSDL(String wsdlPath, boolean doXsdImports) throws Exception {
String wsdlUrl = getClass().getResource(wsdlPath).toString();
LOG.info("the path of wsdl file is " + wsdlUrl);
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
wsdlReader.setFeature("javax.wsdl.verbose", false);
def = wsdlReader.readWSDL(wsdlUrl);
control = EasyMock.createNiceControl();
bus = control.createMock(Bus.class);
bindingFactoryManager = control.createMock(BindingFactoryManager.class);
destinationFactoryManager = control.createMock(DestinationFactoryManager.class);
destinationFactory = control.createMock(DestinationFactory.class);
wsdlServiceBuilder = new WSDLServiceBuilder(bus, false);
for (Service serv : CastUtils.cast(def.getServices().values(), Service.class)) {
if (serv != null) {
service = serv;
break;
}
}
EasyMock.expect(bus.getExtension(WSDLManager.class)).andReturn(new WSDLManagerImpl()).anyTimes();
EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bindingFactoryManager);
EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andReturn(destinationFactoryManager);
EasyMock.expect(destinationFactoryManager.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/")).andReturn(destinationFactory);
control.replay();
serviceInfo = wsdlServiceBuilder.buildServices(def, service).get(0);
ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, serviceInfo);
builder.setUseSchemaImports(doXsdImports);
builder.setBaseFileName("HelloWorld");
newDef = builder.build(new HashMap<String, SchemaInfo>());
}
use of org.apache.cxf.binding.BindingFactoryManager in project cxf by apache.
the class WSDLServiceBuilderTest method buildService.
private void buildService(QName endpointName) throws Exception {
control = EasyMock.createNiceControl();
bus = control.createMock(Bus.class);
bindingFactoryManager = control.createMock(BindingFactoryManager.class);
destinationFactoryManager = control.createMock(DestinationFactoryManager.class);
DestinationFactory destinationFactory = control.createMock(DestinationFactory.class);
WSDLServiceBuilder wsdlServiceBuilder = new WSDLServiceBuilder(bus);
EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bindingFactoryManager).anyTimes();
EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andReturn(destinationFactoryManager).atLeastOnce();
EasyMock.expect(destinationFactoryManager.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/")).andReturn(destinationFactory).anyTimes();
control.replay();
serviceInfos = wsdlServiceBuilder.buildServices(def, service, endpointName);
if (!serviceInfos.isEmpty()) {
serviceInfo = serviceInfos.get(0);
} else {
serviceInfo = null;
}
}
Aggregations