if (log.isDebugEnabled()) {
log.debug("Entered asynchronous (polling) invocation: BaseDispatch.invokeAsync()");
}
// Create the InvocationContext instance for this request/response flow.
InvocationContext invocationContext =
InvocationContextFactory.createInvocationContext(null);
invocationContext.setServiceClient(serviceClient);
// Create the MessageContext to hold the actual request message and its
// associated properties
MessageContext requestMsgCtx = new MessageContext();
requestMsgCtx.setEndpointDescription(getEndpointDescription());
invocationContext.setRequestMessageContext(requestMsgCtx);
/*
* TODO: review: make sure the handlers are set on the InvocationContext
* This implementation of the JAXWS runtime does not use Endpoint, which
* would normally be the place to initialize and store the handler list.
* In lieu of that, we will have to intialize and store them on the
* InvocationContext. also see the InvocationContextFactory. On the client
* side, the binding is not yet set when we call into that factory, so the
* handler list doesn't get set on the InvocationContext object there. Thus
* we gotta do it here.
*/
// be sure to use whatever handlerresolver is registered on the Service
Binding binding = (Binding) getBinding();
invocationContext.setHandlers(binding.getHandlerChain());
initMessageContext(obj, requestMsgCtx);
// Migrate the properties from the client request context bag to
// the request MessageContext.
ApplicationContextMigratorUtil.performMigrationToMessageContext(
Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
getRequestContext(), requestMsgCtx);
// Perform the WebServiceFeature configuration requested by the user.
binding.configure(requestMsgCtx, this);
// Setup the Executor that will be used to drive async responses back to
// the client.
// FIXME: We shouldn't be getting this from the ServiceDelegate, rather each
// Dispatch object should have it's own.
Executor e = serviceDelegate.getExecutor();
invocationContext.setExecutor(e);
// Create the AsyncListener that is to be used by the InvocationController.
AsyncResponse listener = createAsyncResponseListener();
invocationContext.setAsyncResponseListener(listener);
// Send the request using the InvocationController
Response asyncResponse = ic.invokeAsync(invocationContext);
//Check to see if we need to maintain session state