简单问题:
有什么想法吗?
答案 0 :(得分:2)
根据Content-Type
标头,webMethods会选择ContentHandler
来解析输入。原始体可以通过这样的ContentHandler
来保存,但它不是以统一的方式完成的。
示例1,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
示例2,Content-Type: multipart/form-data
:
IDataCursor pipelineCursor = pipeline.getCursor();
InputStream bodyStream = (InputStream)IDataUtil.get( pipelineCursor, "contentStream" );
pipelineCursor.destroy();
// bodyStream now contains the request body