Monday, September 29, 2008

Apache Axis2 Changing the Content-type of the Response

There are a couple of mechanisms that can be used to change the content-type of the response in Apache Axis2. They are,
  • Using HTTP Content Negotiation. Please refer HTTP Content Negotiation with Apache Axis2 for details.
  • Changing the content-type of the response explicitly by setting it to the response message context as follows,
      MessageContext messageContext = MessageContext.getCurrentMessageContext();
OperationContext operationContext = messageContext.getOperationContext();
MessageContext outMessageContext = operationContext.getMessageContext(
WSDL2Constants.MESSAGE_LABEL_OUT);
// responseFormat is the content type of the outgoing message
outMessageContext.setProperty(Constants.Configuration.MESSAGE_TYPE, responseFormat);

1 comment:

Anonymous said...
This comment has been removed by a blog administrator.