当前位置: 代码迷 >> Java Web开发 >> 百分请问,jsp如何接收soap数据包
  详细解决方案

百分请问,jsp如何接收soap数据包

热度:120   发布时间:2016-04-17 12:23:51.0
百分请教,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包,现在…
  相关解决方案