Simple question:
Any ideas?
Depending on the Content-Type
header, webMethods chooses a ContentHandler
to parse the inputs. The raw body can be preserved by such a ContentHandler
, but it's not done in a uniform way.
example 1, for Content-Type: application/x-www-form-urlencoded
:
InvokeState is = InvokeState.getCurrentState();
byte[] bytesIn = (byte[])is.getPrivateData("$msgBytesIn");
String body = null;
if (bytesIn!=null) {
body = new String(bytesIn, StandardCharsets.UTF_8);
}
// body now contains the request body
example 2, for Content-Type: multipart/form-data
:
IDataCursor pipelineCursor = pipeline.getCursor();
InputStream bodyStream = (InputStream)IDataUtil.get( pipelineCursor, "contentStream" );
pipelineCursor.destroy();
// bodyStream now contains the request body