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 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, 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(); }
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, 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 {
backChannel = new BackChannelConduit(address, inMessage); } else { backChannel = conduitInitiator.getConduit(endpointInfo, address);
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 {
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(); }
if (StringUtils.isEmpty(add) || add.equals(ei.getAddress())) { c = conduitInitiator.getConduit(ei, exchange.getBus()); replaceEndpointAddressPropertyIfNeeded(message, add, c); } else { ad.setValue(StringUtils.isEmpty(basePath) ? add : basePath); epr.setAddress(ad); c = conduitInitiator.getConduit(ei, epr, exchange.getBus());
if (StringUtils.isEmpty(add) || add.equals(ei.getAddress())) { c = conduitInitiator.getConduit(ei, exchange.getBus()); replaceEndpointAddressPropertyIfNeeded(message, add, c); } else { ad.setValue(StringUtils.isEmpty(basePath) ? add : basePath); epr.setAddress(ad); c = conduitInitiator.getConduit(ei, epr, exchange.getBus());
public Conduit getBackChannel(Message inMessage) throws IOException { Bus bus = inMessage.getExchange().getBus(); //this is a response targeting a decoupled endpoint. Treat it as a oneway so //we don't wait for a response. inMessage.getExchange().setOneWay(true); ConduitInitiator conduitInitiator = bus.getExtension(ConduitInitiatorManager.class) .getConduitInitiatorForUri(reference.getAddress().getValue()); if (conduitInitiator != null) { Conduit c = conduitInitiator.getConduit(ei, reference, bus); //ensure decoupled back channel input stream is closed c.setMessageObserver(new MessageObserver() { public void onMessage(Message m) { InputStream is = m.getContent(InputStream.class); if (is != null) { try { is.close(); } catch (Exception e) { //ignore } } } }); return c; } return null; } public MessageObserver getMessageObserver() {
public Conduit getBackChannel(Message inMessage) throws IOException { Bus bus = inMessage.getExchange().getBus(); //this is a response targeting a decoupled endpoint. Treat it as a oneway so //we don't wait for a response. inMessage.getExchange().setOneWay(true); ConduitInitiator conduitInitiator = bus.getExtension(ConduitInitiatorManager.class) .getConduitInitiatorForUri(reference.getAddress().getValue()); if (conduitInitiator != null) { Conduit c = conduitInitiator.getConduit(ei, reference, bus); //ensure decoupled back channel input stream is closed c.setMessageObserver(new MessageObserver() { public void onMessage(Message m) { InputStream is = m.getContent(InputStream.class); if (is != null) { try { is.close(); } catch (Exception e) { //ignore } } } }); return c; } return null; } public MessageObserver getMessageObserver() {
public Conduit getBackChannel(Message inMessage, Message partialResponse, EndpointReferenceType address) throws IOException { Bus bus = inMessage.getExchange().get(Bus.class); //this is a response targeting a decoupled endpoint. Treat it as a oneway so //we don't wait for a response. inMessage.getExchange().setOneWay(true); ConduitInitiator conduitInitiator = bus.getExtension(ConduitInitiatorManager.class) .getConduitInitiatorForUri(reference.getAddress().getValue()); if (conduitInitiator != null) { Conduit c = conduitInitiator.getConduit(ei, reference); //ensure decoupled back channel input stream is closed c.setMessageObserver(new MessageObserver() { public void onMessage(Message m) { InputStream is = m.getContent(InputStream.class); if (is != null) { try { is.close(); } catch (Exception e) { //ignore } } } }); return c; } return null; } public MessageObserver getMessageObserver() {
public Conduit getBackChannel(Message inMessage, Message partialResponse, EndpointReferenceType address) throws IOException { Bus bus = inMessage.getExchange().get(Bus.class); //this is a response targeting a decoupled endpoint. Treat it as a oneway so //we don't wait for a response. inMessage.getExchange().setOneWay(true); ConduitInitiator conduitInitiator = bus.getExtension(ConduitInitiatorManager.class) .getConduitInitiatorForUri(reference.getAddress().getValue()); if (conduitInitiator != null) { Conduit c = conduitInitiator.getConduit(ei, reference); //ensure decoupled back channel input stream is closed c.setMessageObserver(new MessageObserver() { public void onMessage(Message m) { InputStream is = m.getContent(InputStream.class); if (is != null) { try { is.close(); } catch (Exception e) { //ignore } } } }); return c; } return null; } public MessageObserver getMessageObserver() {
ad.setValue(address); epr.setAddress(ad); answer = conduitInitiator.getConduit(ei, epr, exchange.getBus());
public Conduit getBackChannel(Message inMessage) throws IOException { if (ContextUtils.isNoneAddress(reference)) { return null; } Bus bus = inMessage.getExchange().getBus(); //this is a response targeting a decoupled endpoint. Treat it as a oneway so //we don't wait for a response. inMessage.getExchange().setOneWay(true); ConduitInitiator conduitInitiator = bus.getExtension(ConduitInitiatorManager.class) .getConduitInitiatorForUri(reference.getAddress().getValue()); if (conduitInitiator != null) { Conduit c = conduitInitiator.getConduit(ei, reference, bus); // ensure decoupled back channel input stream is closed c.setMessageObserver(new MessageObserver() { public void onMessage(Message m) { InputStream is = m.getContent(InputStream.class); if (is != null) { try { is.close(); } catch (Exception e) { // ignore } } } }); return c; } return null; }
public Conduit getBackChannel(Message inMessage) throws IOException { if (ContextUtils.isNoneAddress(reference)) { return null; } Bus bus = inMessage.getExchange().getBus(); //this is a response targeting a decoupled endpoint. Treat it as a oneway so //we don't wait for a response. inMessage.getExchange().setOneWay(true); ConduitInitiator conduitInitiator = bus.getExtension(ConduitInitiatorManager.class) .getConduitInitiatorForUri(reference.getAddress().getValue()); if (conduitInitiator != null) { Conduit c = conduitInitiator.getConduit(ei, reference, bus); // ensure decoupled back channel input stream is closed c.setMessageObserver(new MessageObserver() { public void onMessage(Message m) { InputStream is = m.getContent(InputStream.class); if (is != null) { try { is.close(); } catch (Exception e) { // ignore } } } }); return c; } return null; }
public Conduit getBackChannel(Message inMessage) throws IOException { if (ContextUtils.isNoneAddress(reference)) { return null; } Bus bus = inMessage.getExchange().getBus(); //this is a response targeting a decoupled endpoint. Treat it as a oneway so //we don't wait for a response. inMessage.getExchange().setOneWay(true); ConduitInitiator conduitInitiator = bus.getExtension(ConduitInitiatorManager.class) .getConduitInitiatorForUri(reference.getAddress().getValue()); if (conduitInitiator != null) { Conduit c = conduitInitiator.getConduit(ei, reference, bus); // ensure decoupled back channel input stream is closed c.setMessageObserver(new MessageObserver() { public void onMessage(Message m) { InputStream is = m.getContent(InputStream.class); if (is != null) { try { is.close(); } catch (Exception e) { // ignore } } } }); return c; } return null; }
final Conduit c = ci.getConduit(info, BusFactory.getThreadDefaultBus(false)); //TODO verify bus