/** * Creates a message with a mocked EndpointReference in the 'from' field to * simulate a comet reference (because requests are coming from browsers). * This is needed by the callback mechanism to have a source for the * request. * * @param args * arguments for the method invocation * @param sessionId * the session id of the client * @param callbackMethod * method to call once a response is available * @return an invocation message */ private Message createMessageWithMockedCometReference(Object[] args, String sessionId, String callbackMethod) { Message msg = new MessageImpl(); msg.getHeaders().put(Constants.MESSAGE_ID, sessionId); msg.setBody(args); EndpointReference re = new RuntimeEndpointReferenceImpl(); RuntimeEndpointImpl callbackEndpoint = new RuntimeEndpointImpl(); callbackEndpoint.setURI(callbackMethod); re.setCallbackEndpoint(callbackEndpoint); msg.setFrom(re); return msg; }
(callbackEndpoint.getBinding() != null) && (callbackEndpoint.getBinding().getType().equals(endpointReference.getBinding().getType()))){ endpointReference.setCallbackEndpoint(callbackEndpoint); break;
(callbackEndpoint.getBinding() != null) && (callbackEndpoint.getBinding().getType().equals(endpointReference.getBinding().getType()))){ endpointReference.setCallbackEndpoint(callbackEndpoint); break;
/** * If there is a callback address, create an EPR for the callback with a referenced endpoint that contains * the binding and the target callback address * @param callbackAddress - the callback address - may be null * @param inMC - the Axis incoming message context * @param msg - the Tuscany message * @throws AxisFault - if the callback address has any of the disallowed forms of callback address */ private void createCallbackEPR( String callbackAddress, MessageContext inMC, Message msg ) throws AxisFault { if (callbackAddress != null ) { // Check for special (& not allowed!) WS_Addressing values checkCallbackAddress( callbackAddress, inMC ); // EndpointReference from = assemblyFactory.createEndpointReference(); Endpoint fromEndpoint = assemblyFactory.createEndpoint(); from.setTargetEndpoint(fromEndpoint); from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED); msg.setFrom(from); RuntimeEndpoint callbackEndpoint = (RuntimeEndpoint)assemblyFactory.createEndpoint(); // WebServiceBinding cbBinding = webServiceBindingFactory.createWebServiceBinding(); cbBinding.setURI(callbackAddress); callbackEndpoint.setBinding(cbBinding); // callbackEndpoint.setURI(callbackAddress); callbackEndpoint.setUnresolved(true); from.setCallbackEndpoint(callbackEndpoint); } // end if } // end method createCallbackEPR
endpointReference.setCallbackEndpoint(callbackEndpoint);
from.setCallbackEndpoint(callbackEndpoint);