public Conduit getConduit(EndpointInfo ei, EndpointReferenceType target, Bus bus) throws IOException { String address = target == null ? ei.getAddress() : target.getAddress().getValue(); BindingInfo bi = ei.getBinding(); String transId = ei.getTransportId(); if (bi instanceof SoapBindingInfo) { transId = ((SoapBindingInfo)bi).getTransportURI(); if (transId == null) { transId = ei.getTransportId(); } } ConduitInitiator conduitInit; try { ConduitInitiatorManager mgr = bus.getExtension(ConduitInitiatorManager.class); if (StringUtils.isEmpty(address) || address.startsWith("http") || address.startsWith("jms") || address.startsWith("soap.udp")) { conduitInit = mgr.getConduitInitiator(mapTransportURI(transId, address)); } else { conduitInit = mgr.getConduitInitiatorForUri(address); } if (conduitInit == null) { throw new RuntimeException(String.format(CANNOT_GET_CONDUIT_ERROR, address, transId)); } return conduitInit.getConduit(ei, target, bus); } catch (BusException e) { throw new RuntimeException(String.format(CANNOT_GET_CONDUIT_ERROR, address, transId)); } }
private void cleanUpDeadDestination() throws DeploymentException { JBITransportFactory jbiTransportFactory; try { jbiTransportFactory = (JBITransportFactory)getBus() .getExtension(ConduitInitiatorManager.class).getConduitInitiator(CxfSeComponent.JBI_TRANSPORT_ID); } catch (BusException e) { throw new DeploymentException(e); } if (jbiTransportFactory != null && getPojoService() != null && getPojoInterfaceName() != null) { jbiTransportFactory.removeDestination(getPojoService().toString() + getPojoInterfaceName().toString()); } }
public byte[] invokeBytes(String address, String transport, byte[] message) throws Exception { EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http"); ei.setAddress(address); ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class); ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport); Conduit conduit = conduitInit.getConduit(ei); TestMessageObserver obs = new TestMessageObserver(); conduit.setMessageObserver(obs); Message m = new MessageImpl(); conduit.prepare(m); OutputStream os = m.getContent(OutputStream.class); os.write(message); // TODO: shouldn't have to do this. IO caching needs cleaning // up or possibly removal... os.flush(); os.close(); return obs.getResponseStream().toByteArray(); }
public Conduit getConduit(EndpointInfo ei, EndpointReferenceType target, Bus bus) throws IOException { String address = target == null ? ei.getAddress() : target.getAddress().getValue(); BindingInfo bi = ei.getBinding(); String transId = ei.getTransportId(); if (bi instanceof SoapBindingInfo) { transId = ((SoapBindingInfo)bi).getTransportURI(); if (transId == null) { transId = ei.getTransportId(); } } ConduitInitiator conduitInit; try { ConduitInitiatorManager mgr = bus.getExtension(ConduitInitiatorManager.class); if (StringUtils.isEmpty(address) || address.startsWith("http") || address.startsWith("jms") || address.startsWith("soap.udp")) { conduitInit = mgr.getConduitInitiator(mapTransportURI(transId, address)); } else { conduitInit = mgr.getConduitInitiatorForUri(address); } if (conduitInit == null) { throw new RuntimeException(String.format(CANNOT_GET_CONDUIT_ERROR, address, transId)); } return conduitInit.getConduit(ei, target, bus); } catch (BusException e) { throw new RuntimeException(String.format(CANNOT_GET_CONDUIT_ERROR, address, transId)); } }
public byte[] invokeBytes(String address, String transport, byte[] message) throws Exception { EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http"); ei.setAddress(address); ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class); ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport); Conduit conduit = conduitInit.getConduit(ei); TestMessageObserver obs = new TestMessageObserver(); conduit.setMessageObserver(obs); Message m = new MessageImpl(); conduit.prepare(m); OutputStream os = m.getContent(OutputStream.class); os.write(message); // TODO: shouldn't have to do this. IO caching needs cleaning // up or possibly removal... os.flush(); os.close(); return obs.getResponseStream().toByteArray(); }
public byte[] invokeBytes(String address, String transport, byte[] message) throws Exception { EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http"); ei.setAddress(address); ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class); ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport); Conduit conduit = conduitInit.getConduit(ei, getBus()); TestMessageObserver obs = new TestMessageObserver(); conduit.setMessageObserver(obs); Message m = new MessageImpl(); conduit.prepare(m); OutputStream os = m.getContent(OutputStream.class); os.write(message); // TODO: shouldn't have to do this. IO caching needs cleaning // up or possibly removal... os.flush(); os.close(); return obs.getResponseStream().toByteArray(); }
@Override protected WSDLEndpointFactory getWSDLEndpointFactory() { if (destinationFactory == null) { try { destinationFactory = getBus().getExtension(DestinationFactoryManager.class) .getDestinationFactory(transportId); } catch (Throwable t) { try { Object o = getBus().getExtension(ConduitInitiatorManager.class) .getConduitInitiator(transportId); if (o instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)o; } } catch (Throwable th) { //ignore } } } if (destinationFactory instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)destinationFactory; } return null; }
public byte[] invokeBytes(String address, String transport, String message) throws Exception { EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http"); ei.setAddress(address); ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class); ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport); Conduit conduit = conduitInit.getConduit(ei); TestMessageObserver obs = new TestMessageObserver(); conduit.setMessageObserver(obs); Message m = new MessageImpl(); conduit.prepare(m); OutputStream os = m.getContent(OutputStream.class); InputStream is = getResourceAsStream(message); if (is == null) { throw new RuntimeException("Could not find resource " + message); } IOUtils.copy(is, os); // TODO: shouldn't have to do this. IO caching needs cleaning // up or possibly removal... os.flush(); is.close(); os.close(); byte[] bs = obs.getResponseStream().toByteArray(); return bs; } public byte[] invokeBytes(String address, String transport, byte[] message) throws Exception {
@Override protected WSDLEndpointFactory getWSDLEndpointFactory() { if (destinationFactory == null) { try { destinationFactory = getBus().getExtension(DestinationFactoryManager.class) .getDestinationFactory(transportId); } catch (Throwable t) { try { Object o = getBus().getExtension(ConduitInitiatorManager.class) .getConduitInitiator(transportId); if (o instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)o; } } catch (Throwable th) { //ignore } } } if (destinationFactory instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)destinationFactory; } return null; }
public byte[] invokeBytes(String address, String transport, String message) throws Exception { EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http"); ei.setAddress(address); ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class); ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport); Conduit conduit = conduitInit.getConduit(ei); TestMessageObserver obs = new TestMessageObserver(); conduit.setMessageObserver(obs); Message m = new MessageImpl(); conduit.prepare(m); OutputStream os = m.getContent(OutputStream.class); InputStream is = getResourceAsStream(message); if (is == null) { throw new RuntimeException("Could not find resource " + message); } IOUtils.copy(is, os); // TODO: shouldn't have to do this. IO caching needs cleaning // up or possibly removal... os.flush(); is.close(); os.close(); byte[] bs = obs.getResponseStream().toByteArray(); return bs; } public byte[] invokeBytes(String address, String transport, byte[] message) throws Exception {
@Override protected WSDLEndpointFactory getWSDLEndpointFactory() { if (destinationFactory == null) { try { destinationFactory = getBus().getExtension(DestinationFactoryManager.class) .getDestinationFactory(transportId); } catch (Throwable t) { try { Object o = getBus().getExtension(ConduitInitiatorManager.class) .getConduitInitiator(transportId); if (o instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)o; } } catch (Throwable th) { //ignore } } } if (destinationFactory instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)destinationFactory; } return null; }
public byte[] invokeBytes(String address, String transport, String message) throws Exception { EndpointInfo ei = new EndpointInfo(null, "http://schemas.xmlsoap.org/soap/http"); ei.setAddress(address); ConduitInitiatorManager conduitMgr = getBus().getExtension(ConduitInitiatorManager.class); ConduitInitiator conduitInit = conduitMgr.getConduitInitiator(transport); Conduit conduit = conduitInit.getConduit(ei, getBus()); TestMessageObserver obs = new TestMessageObserver(); conduit.setMessageObserver(obs); Message m = new MessageImpl(); conduit.prepare(m); OutputStream os = m.getContent(OutputStream.class); InputStream is = getResourceAsStream(message); if (is == null) { throw new RuntimeException("Could not find resource " + message); } IOUtils.copy(is, os); // TODO: shouldn't have to do this. IO caching needs cleaning // up or possibly removal... os.flush(); is.close(); os.close(); return obs.getResponseStream().toByteArray(); }
@Override protected WSDLEndpointFactory getWSDLEndpointFactory() { if (destinationFactory instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)destinationFactory; } try { Object o = getBus().getExtension(ConduitInitiatorManager.class) .getConduitInitiator(transportId); if (o instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)o; } } catch (Throwable t) { //ignore } if (destinationFactory == null) { try { destinationFactory = getBus().getExtension(DestinationFactoryManager.class) .getDestinationFactory(transportId); } catch (Throwable t) { //ignore } } return null; } public Client create() {
@Override protected WSDLEndpointFactory getWSDLEndpointFactory() { if (destinationFactory == null) { try { destinationFactory = getBus().getExtension(DestinationFactoryManager.class) .getDestinationFactory(transportId); } catch (Throwable t) { try { Object o = getBus().getExtension(ConduitInitiatorManager.class) .getConduitInitiator(transportId); if (o instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)o; } } catch (Throwable th) { //ignore } } } if (destinationFactory instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)destinationFactory; } return null; }
@Override protected WSDLEndpointFactory getWSDLEndpointFactory() { if (destinationFactory instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)destinationFactory; } try { Object o = getBus().getExtension(ConduitInitiatorManager.class) .getConduitInitiator(transportId); if (o instanceof WSDLEndpointFactory) { return (WSDLEndpointFactory)o; } } catch (Throwable t) { //ignore } if (destinationFactory == null) { try { destinationFactory = getBus().getExtension(DestinationFactoryManager.class) .getDestinationFactory(transportId); } catch (Throwable t) { //ignore } } return null; } public Client create() {
@Override public void stop() throws Exception { if (isUseAegis()) { server.stop(); } else { endpoint.stop(); } ReflectionUtils.callLifecycleMethod(getPojo(), PreDestroy.class); JBIDispatcherUtil.clean(); JBITransportFactory jbiTransportFactory = (JBITransportFactory)getBus() .getExtension(ConduitInitiatorManager.class).getConduitInitiator(CxfSeComponent.JBI_TRANSPORT_ID); jbiTransportFactory.setDeliveryChannel(null); jbiTransportFactory.removeDestination(getPojoService().toString() + getPojoInterfaceName().toString()); super.stop(); }
cim.getConduitInitiator("http://cxf.apache.org/unknown"); } catch (BusException ex) { cim.getConduitInitiator("http://cxf.apache.org/transports/http")); assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/jms")); assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/jms/configuration"));
for (String ns : getTransportIds()) { try { if (cim.getConduitInitiator(ns) == this) { cim.deregisterConduitInitiator(ns);
private void checkHTTPTransportFactories(Bus bus) throws BusException { ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class); assertNotNull("No conduit initiator manager", cim); assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/http")); assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://schemas.xmlsoap.org/wsdl/http/")); assertNotNull("conduit initiator not available", cim.getConduitInitiator("http://cxf.apache.org/transports/http/configuration")); DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class); assertNotNull("No destination factory manager", dfm); assertNotNull("destination factory not available", dfm.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/")); assertNotNull("destination factory not available", dfm.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http")); assertNotNull("destination factory not available", dfm.getDestinationFactory("http://schemas.xmlsoap.org/wsdl/http/")); assertNotNull("destination factory not available", dfm.getDestinationFactory("http://cxf.apache.org/transports/http/configuration")); }
for (String ns : getTransportIds()) { try { if (cim.getConduitInitiator(ns) == this) { cim.deregisterConduitInitiator(ns);