public static Handler.InvocationResponse processXMLRequest(MessageContext msgContext,
InputStream in,
OutputStream out,
String contentType) throws AxisFault {
try {
msgContext.setDoingREST(true);
String charSetEncoding = BuilderUtil.getCharSetEncoding(contentType);
msgContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING, charSetEncoding);
dispatchAndVerify(msgContext);
in = HTTPTransportUtils.handleGZip(msgContext, in);
SOAPEnvelope soapEnvelope = TransportUtils
.createSOAPMessage(msgContext, in, contentType);
msgContext.setEnvelope(soapEnvelope);
msgContext.setProperty(Constants.Configuration.CONTENT_TYPE,
contentType);
msgContext.setProperty(MessageContext.TRANSPORT_OUT, out);
} catch (AxisFault axisFault) {
throw axisFault;
} catch (XMLStreamException e) {
throw AxisFault.makeFault(e);
} catch (IOException e) {
throw AxisFault.makeFault(e);
} finally {
String messageType =
(String) msgContext.getProperty(Constants.Configuration.MESSAGE_TYPE);
if (HTTPConstants.MEDIA_TYPE_X_WWW_FORM.equals(messageType) ||
HTTPConstants.MEDIA_TYPE_MULTIPART_FORM_DATA.equals(messageType)) {
msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE,
HTTPConstants.MEDIA_TYPE_APPLICATION_XML);
}
}
return invokeAxisEngine(msgContext);
}
|