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());
SOAPConnection调用WebService
最新推荐文章于 2023-11-09 17:59:19 发布