日期:2014-05-18  浏览次数:20681 次

百分请教,jsp怎么接收soap数据包
String xmlStr = "";
InputStream xml = null;
StringBuffer sb = new StringBuffer();
DataInputStream ioDataIn = null;
String line = null;
xml = request.getInputStream();
ioDataIn = new DataInputStream(xml);
line = ioDataIn.readLine();
while (! (line == null)) {
sb.append(line);
line = ioDataIn.readLine();
}
xmlStr = sb.toString();
我用上面的代码能取到POST过来的SOAP包,现在对方改成把SOAP包GET过来我就什么都取不到了,谁能告诉我怎么改一下才行 谢谢!

------解决方案--------------------
之前POST应该是在HTTP BODY里面所以request.getInputStream直接读应该没问题。

GET似乎是类似URL那样传过来的吗?怀疑需要类似request.getParameter那样拿吧。
------解决方案--------------------
引用楼主 jishuo 的帖子:
String xmlStr = "";
InputStream xml = null;
StringBuffer sb = new StringBuffer();
DataInputStream ioDataIn = null;
String line = null;
xml = request.getInputStream();
ioDataIn = new DataInputStream(xml);
line = ioDataIn.readLine();
while (! (line == null)) {
sb.append(line);
line = ioDataIn.readLine();
}
xmlStr = sb.toString();
我用上面的代码能取到POST过来的SOAP包,现在…