protected void doPost(MuleEventContext context, AxisStringWriter response)
throws Exception
{
String soapAction;
Message responseMsg;
AxisEngine engine = getAxis();
if (engine == null)
{
throw new MessagingException(CoreMessages.objectIsNull("Axis Engine"), context.getMessage());
}
MessageContext msgContext = new MessageContext(engine);
String contentType;
try
{
//EndpointURI endpointUri = getEndpoint(context);
EndpointURI endpointUri = context.getEndpointURI();
populateMessageContext(msgContext, context, endpointUri);
if (securityProvider != null)
{
if (logger.isDebugEnabled())
{
logger.debug("securityProvider:" + securityProvider);
}
msgContext.setProperty("securityProvider", securityProvider);
}
Object request = context.getMessage().getPayload();
if (request instanceof File)
{
request = new FileInputStream((File)request);
}
else if (request instanceof byte[])
{
request = new ByteArrayInputStream((byte[])request);
}
final String cType = context.getMessage().getInboundProperty(HTTPConstants.HEADER_CONTENT_TYPE);
final String cLocation = context.getMessage().getInboundProperty(HTTPConstants.HEADER_CONTENT_LOCATION);
Message requestMsg = new Message(request, false, cType, cLocation);
if (logger.isDebugEnabled())
{
logger.debug("Request Message:" + requestMsg);
}
msgContext.setRequestMessage(requestMsg);
msgContext.setProperty("transport.url", endpointUri.toString());
soapAction = getSoapAction(context);
if (soapAction != null)
{
msgContext.setUseSOAPAction(true);
msgContext.setSOAPActionURI(soapAction);
}
msgContext.setSession(new AxisMuleSession(context.getSession()));
if (logger.isDebugEnabled())
{
logger.debug("Invoking Axis Engine.");
}
AxisServiceProxy.setProperties(RequestContext.getEvent().getEndpoint().getProperties());
engine.invoke(msgContext);
if (logger.isDebugEnabled())
{
logger.debug("Return from Axis Engine.");
}
if (RequestContext.getExceptionPayload() instanceof Exception)