use of org.apache.cxf.wsdl11.WSDLManagerImpl in project cxf by apache.
the class AbstractAegisTest method setUp.
@Before
public void setUp() throws Exception {
super.setUpBus();
SoapBindingFactory bindingFactory = new SoapBindingFactory();
bindingFactory.setBus(bus);
bus.getExtension(BindingFactoryManager.class).registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bindingFactory);
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
SoapTransportFactory soapDF = new SoapTransportFactory();
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
dfm.registerDestinationFactory(SoapBindingConstants.SOAP11_BINDING_ID, soapDF);
dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", soapDF);
localTransport = new LocalTransportFactory();
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
dfm.registerDestinationFactory("http://cxf.apache.org/bindings/xformat", localTransport);
dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", localTransport);
ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class);
extension.registerConduitInitiator(LocalTransportFactory.TRANSPORT_ID, localTransport);
extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/", localTransport);
extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", localTransport);
extension.registerConduitInitiator(SoapBindingConstants.SOAP11_BINDING_ID, localTransport);
bus.setExtension(new WSDLManagerImpl(), WSDLManager.class);
// WoodstoxValidationImpl wstxVal = new WoodstoxValidationImpl();
addNamespace("wsdl", WSDLConstants.NS_WSDL11);
addNamespace("wsdlsoap", WSDLConstants.NS_SOAP11);
addNamespace("xsd", WSDLConstants.NS_SCHEMA_XSD);
}
use of org.apache.cxf.wsdl11.WSDLManagerImpl in project cxf by apache.
the class Wsdl11AttachmentPolicyProviderTest method oneTimeSetUp.
@BeforeClass
public static void oneTimeSetUp() throws Exception {
IMocksControl control = EasyMock.createNiceControl();
Bus bus = control.createMock(Bus.class);
WSDLManager manager = new WSDLManagerImpl();
WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andReturn(dfm).anyTimes();
EasyMock.expect(dfm.getDestinationFactory(EasyMock.isA(String.class))).andReturn(null).anyTimes();
BindingFactoryManager bfm = control.createMock(BindingFactoryManager.class);
EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bfm).anyTimes();
EasyMock.expect(bfm.getBindingFactory(EasyMock.isA(String.class))).andReturn(null).anyTimes();
control.replay();
int n = 19;
services = new ServiceInfo[n];
endpoints = new EndpointInfo[n];
for (int i = 0; i < n; i++) {
String resourceName = "/attachment/wsdl11/test" + i + ".wsdl";
URL url = Wsdl11AttachmentPolicyProviderTest.class.getResource(resourceName);
try {
services[i] = builder.buildServices(manager.getDefinition(url.toString())).get(0);
} catch (WSDLException ex) {
ex.printStackTrace();
fail("Failed to build service from resource " + resourceName);
}
assertNotNull(services[i]);
endpoints[i] = services[i].getEndpoints().iterator().next();
assertNotNull(endpoints[i]);
}
control.verify();
}
use of org.apache.cxf.wsdl11.WSDLManagerImpl in project cxf by apache.
the class OASISCatalogTest method testClientWithoutCatalog.
@Test
public void testClientWithoutCatalog() throws Exception {
URL wsdl = getClass().getResource("/wsdl/catalog/hello_world_services.wsdl");
assertNotNull(wsdl);
// set Catalog on the Bus
Bus bus = BusFactory.getDefaultBus();
OASISCatalogManager catalog = new OASISCatalogManager();
bus.setExtension(catalog, OASISCatalogManager.class);
// prevent cache from papering over the lack of a schema.
WSDLManagerImpl mgr = (WSDLManagerImpl) bus.getExtension(WSDLManager.class);
mgr.setDisableSchemaCache(true);
try {
SOAPService service = new SOAPService(wsdl, serviceName);
service.getPort(portName, Greeter.class);
fail("Test did not fail as expected");
} catch (WebServiceException e) {
// ignore
}
// update catalog dynamically now
Enumeration<URL> jaxwscatalog = getClass().getClassLoader().getResources("META-INF/jax-ws-catalog.xml");
assertNotNull(jaxwscatalog);
while (jaxwscatalog.hasMoreElements()) {
URL url = jaxwscatalog.nextElement();
catalog.loadCatalog(url);
}
SOAPService service = new SOAPService(wsdl, serviceName);
Greeter greeter = service.getPort(portName, Greeter.class);
assertNotNull(greeter);
bus.shutdown(true);
}
use of org.apache.cxf.wsdl11.WSDLManagerImpl in project cxf by apache.
the class ServerImpl method registerCallback.
public String registerCallback(NestedCallback callbackObject) {
try {
W3CEndpointReference w3cEpr = callbackObject.getCallback();
EndpointReferenceType callback = ProviderImpl.convertToInternal(w3cEpr);
WSDLManager manager = new WSDLManagerImpl();
QName interfaceName = EndpointReferenceUtils.getInterfaceName(callback, bus);
String wsdlLocation = EndpointReferenceUtils.getWSDLLocation(callback);
QName serviceName = EndpointReferenceUtils.getServiceName(callback, bus);
String address = EndpointReferenceUtils.getAddress(callback);
String portString = EndpointReferenceUtils.getPortName(callback);
QName portName = new QName(serviceName.getNamespaceURI(), portString);
StringBuilder seiName = new StringBuilder();
seiName.append(JAXBUtils.namespaceURIToPackage(interfaceName.getNamespaceURI()));
seiName.append(".");
seiName.append(JAXBUtils.nameToIdentifier(interfaceName.getLocalPart(), JAXBUtils.IdentifierType.INTERFACE));
Class<?> sei = null;
try {
sei = Class.forName(seiName.toString(), true, manager.getClass().getClassLoader());
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
URL wsdlURL = new URL(wsdlLocation);
Service service = Service.create(wsdlURL, serviceName);
CallbackPortType port = (CallbackPortType) service.getPort(portName, sei);
((BindingProvider) port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);
port.serverSayHi("Sean");
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
return "registerCallback called";
}
use of org.apache.cxf.wsdl11.WSDLManagerImpl in project cxf by apache.
the class TestBase method common.
protected void common(String wsdl, QName portName, Class<?>... jaxbClasses) throws Exception {
control = EasyMock.createNiceControl();
bus = control.createMock(Bus.class);
WSDLManagerImpl manager = new WSDLManagerImpl();
XMLWSDLExtensionLoader.registerExtensors(manager);
EasyMock.expect(bus.getExtension(WSDLManager.class)).andStubReturn(manager);
BindingFactoryManager bindingFactoryManager = control.createMock(BindingFactoryManager.class);
EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andStubReturn(bindingFactoryManager);
DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andStubReturn(dfm);
control.replay();
assertNotNull(bus.getExtension(WSDLManager.class));
WSDLServiceFactory factory = new WSDLServiceFactory(bus, getClass().getResource(wsdl).toString(), new QName(portName.getNamespaceURI(), "XMLService"));
org.apache.cxf.service.Service service = factory.create();
EndpointInfo epi = service.getEndpointInfo(portName);
serviceInfo = epi.getService();
assertNotNull(epi);
Binding xmlBinding = new XMLBindingFactory().createBinding(epi.getBinding());
control.reset();
JAXBDataBinding db = new JAXBDataBinding();
db.initialize(service);
db.setContext(JAXBContext.newInstance(jaxbClasses));
service.setDataBinding(db);
Endpoint endpoint = control.createMock(EndpointImpl.class);
EasyMock.expect(endpoint.getEndpointInfo()).andStubReturn(epi);
EasyMock.expect(endpoint.getBinding()).andStubReturn(xmlBinding);
EasyMock.expect(endpoint.getService()).andStubReturn(service);
EasyMock.expect(endpoint.isEmpty()).andReturn(true).anyTimes();
control.replay();
xmlMessage.getExchange().put(Endpoint.class, endpoint);
xmlMessage.getExchange().put(org.apache.cxf.service.Service.class, service);
}
Aggregations