欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > IT业 > springboot3通过HttpRequest请求soap

springboot3通过HttpRequest请求soap

2025/4/3 5:38:38 来源:https://blog.csdn.net/cq_run/article/details/142548406  浏览:    关键词:springboot3通过HttpRequest请求soap

http://10.20.0.11:80/wms/index.php/Home/SOAP/getVehStatus为请求地址

其中所有的getOfflineAmount字段都是调用的方法名

public static String getOfflineAmount() {String result2 = HttpRequest.post("http://10.20.0.11:80/wms/index.php/Home/SOAP/getVehStatus").header(Header.USER_AGENT, "Hutool http").header("SOAPAction", "urn:Veh##getOfflineAmount").header("Content-Type", "ext/xml;charset=UTF-8").body("<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:Veh\">\n"+ "   <soapenv:Header/>\n"+ "   <soapenv:Body>\n"+ "      <urn:getOfflineAmount soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n"//需要传的参数  vin和stationId是字段名  vin和stationCode是字段值//+ "         <vin xsi:type=\"xsd:string\">" + vin + "</vin>\n"//+ "         <stationId xsi:type=\"xsd:string\">" + stationCode + "</stationId>\n"+ "      </urn:getOfflineAmount>\n"+ "   </soapenv:Body>\n"+ "</soapenv:Envelope>").timeout(20000)//超时,毫秒.execute().body();Document docResult = XmlUtil.readXML(result2);Object value = XmlUtil.getByXPath("//SOAP-ENV:Envelope/SOAP-ENV:Body/ns1:getOfflineAmountResponse/getOfflineAmount", docResult, XPathConstants.STRING);if (!"error".equalsIgnoreCase(value.toString())) {return value.toString();} else {return null;}}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词