`
showcup
  • 浏览: 24006 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

SOAPConnection调用WebService

阅读更多
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance(); SOAPConnection con = factory.createConnection(); SOAPMessage request = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL).createMessage(); request.getSOAPHeader().detachNode(); SOAPBody body = request.getSOAPBody(); SOAPElement getMessage = body.addChildElement("call", "ns1", ASIP_NS); getMessage.setEncodingStyle(SOAPConstants.URI_NS_SOAP_ENCODING); // 第一个参数 SOAPElement in0 = getMessage.addChildElement("in0"); in0.addTextNode("predeal"); // 第二个参数 SOAPElement in1 = getMessage.addChildElement("in1"); in1.addTextNode(message.getBusinessServiceParam()); //第三个参数 SOAPElement in2 = getMessage.addChildElement("in2"); in2.addTextNode("predeal"); request.writeTo(System.out); SOAPMessage response = con.call(request, "http://172.16.29.212:8000/asip/services/AsipService"); Node callResponse = response.getSOAPBody().getFirstChild(); Node callReturn = callResponse.getFirstChild(); System.out.println("\n响应内容:"+callReturn.getTextContent());
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics