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
SOAP请求与响应处理
最新推荐文章于 2023-11-09 17:59:19 发布
本文介绍了一种使用Java实现SOAP协议进行远程服务调用的方法。通过创建SOAP连接和消息实例,设置请求参数,并调用远程服务获取响应。具体步骤包括初始化SOAP连接、构造SOAP消息、设置请求参数以及解析返回结果。
1413

被折叠的 条评论
为什么被折叠?



