当前位置:   article > 正文

webservice服务利用hutool工具调用wsdl超简单_hutool

hutool

海康接口为例:

<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"xmlns:tns="http://www.hikvision.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="queryData" targetNamespace="http://www.hikvision.com/">

<wsdl:types>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.hikvision.com/" elementFormDefault="unqualified"targetNamespace="http://www.hikvision.com/" version="1.0">

<xs:element name="login" type="tns:login"/>

<xs:element name="loginResponse" type="tns:loginResponse"/>

<xs:element name="logout" type="tns:logout"/>

<xs:element name="logoutResponse" type="tns:logoutResponse"/>

<xs:element name="queryIntellData" type="tns:queryIntellData"/>

<xs:element name="queryIntellDataResponse" type="tns:queryIntellDataResponse"/>

<xs:element name="updateIntellData" type="tns:updateIntellData"/>

<xs:element name="updateIntellDataResponse" type="tns:updateIntellDataResponse"/>

<xs:complexType name="logout">...</xs:complexType>

<xs:complexType name="logoutResponse">...</xs:complexType>

<xs:complexType name="queryIntellData">...</xs:complexType>

<xs:complexType name="queryIntellDataResponse">...</xs:complexType>

<xs:complexType name="updateIntellData">...</xs:complexType>

<xs:complexType name="updateIntellDataResponse">...</xs:complexType>

<xs:complexType name="login">...</xs:complexType>

<xs:complexType name="loginResponse">...</xs:complexType>

</xs:schema>

</wsdl:types>

<wsdl:message name="logout">...</wsdl:message>

<wsdl:message name="logoutResponse">...</wsdl:message>

<wsdl:message name="loginResponse">...</wsdl:message>

<wsdl:message name="updateIntellData">...</wsdl:message>

<wsdl:message name="queryIntellDataResponse">...</wsdl:message>

<wsdl:message name="updateIntellDataResponse">...</wsdl:message>

<wsdl:message name="queryIntellData">...</wsdl:message>

<wsdl:message name="login">...</wsdl:message>

<wsdl:portType name="queryData">...</wsdl:portType>

<wsdl:binding name="queryDataSoapBinding" type="tns:queryData">...</wsdl:binding>

<wsdl:service name="queryData">...</wsdl:service>

</wsdl:definitions>

 

命名空间:

targetNamespace="http://www.hikvision.com/"

调用方法名(带前缀):  tns:queryIntellData

<xs:element name="queryIntellData" type="tns:queryIntellData"/>

java代码调用:

Map<String, Object> params = new HashMap<>();
JSONObject jsonObject = new JSONObject();
jsonObject.put("token", "XXX");
jsonObject.put("startTime", "2020-11-10 00:00:00");
jsonObject.put("endTime", "2020-12-22 00:00:00");
params.put("queryJson", JSON.toJSONString(jsonObject));
params.put("orderType", "DESC");
params.put("orderField", "collectTime");
params.put("pageSize", 10000);
params.put("pageNo", 0);

SoapClient soapClient = SoapClient.create("接口地址")
        .setMethod("tns:queryIntellData", "http://www.hikvision.com/")
        .setParams(params, false);//false不带前缀
String send = soapClient.send(true);
System.out.println(send);
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/507697
推荐阅读
相关标签