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());
Message requestMsg = createRequestMessage(obj);
setupMessageProperties(requestMsg);
requestMsgCtx.setMessage(requestMsg);
// 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);
// Send the request using the InvocationController
ic.invoke(invocationContext);
MessageContext responseMsgCtx = invocationContext.getResponseMessageContext();
responseMsgCtx.setEndpointDescription(requestMsgCtx.getEndpointDescription());
// Migrate the properties from the response MessageContext back
// to the client response context bag.
ApplicationContextMigratorUtil.performMigrationFromMessageContext(
Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
getResponseContext(), responseMsgCtx);
if (hasFaultResponse(responseMsgCtx)) {
WebServiceException wse = BaseDispatch.getFaultResponse(responseMsgCtx);
throw wse;
}
Message responseMsg = responseMsgCtx.getMessage();
Object returnObj = getValueFromMessage(responseMsg);
//Check to see if we need to maintain session state
checkMaintainSessionState(requestMsgCtx, invocationContext);