gsoap_Serve_ReadWrite

webservice接口。可以使用soap协议获取和设置网关的数据。


gsoap协议
该驱动使用的gsoap配置文件为,不可修改/root/Web3.0/project/scada-wsdl-fangzhen.xml

通讯方式选择TCPServer模式  只需要填写端口号即可 IP地址不需要填写,端口填写8099


提供两个有效接口供调用
1、获取实时数据接口 RequestEquipmentParam
调用此接口的xml报文格式如下
<?xml version="1.0" encoding="UTF-8"?>
<EQUIP>
    <EQUIPCODE>EQ001</EQUIPCODE>
</EQUIP>

返回值报文,返回EQ001设备的所有点的值
<?xml version="1.0" encoding="UTF-8"?>
<EQUIP>
 <EQUIPCODE>EQ001</EQUIPCODE>
 <EQUIPPARAMS>
  <EQUIPPARAM>
   <EPCODE>YC1</EPCODE>
   <VALUE>1264</VALUE>
  </EQUIPPARAM>
  <EQUIPPARAM>
   <EPCODE>YC2</EPCODE>
   <VALUE>1264</VALUE>
  </EQUIPPARAM>
 </EQUIPPARAMS>
</EQUIP>

2、设置实时数据接口 Equipments
调用此接口的xml报文格式如下
<?xml version="1.0" encoding="UTF-8"?>
<EQUIP>
 <EQUIPCODE>EQ001</EQUIPCODE>
 <EQUIPPARAMS>
  <EQUIPPARAM>
   <EPCODE>YC1</EPCODE>
   <VALUE>1264</VALUE>
  </EQUIPPARAM></EQUIPPARAMS>
</EQUIP>
设置成功返回1,设置失败返回0


需要将/root/Web3.0/project/scada-wsdl-fangzhen.xml文件中的<soap:address>节点中的IP地址和端口号修改为本机的IP地址和端口号即可,例如本机IP地址为192.168.75.243则需要按照如下方式修改
      <soap:address location="http://192.168.75.243:8099/OpcServer/ws/scadaws"/>



以下是针对两个接口,使用网络调试工具进行测试的交互报文

读数据交互报文
[2019-12-09 14:07:37.161]# SEND ASCII>
POST /OpcServer/ws/scadaws HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 521
Host: 192.168.0.199:8099
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.util.opc.zkzh.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:RequestEquipmentParam>
         <!--Optional:-->
         <data><?xml version="1.0" encoding="UTF-8"?>
<EQUIP>
 <EQUIPCODE>EQ001</EQUIPCODE>
 <EQUIPPARAMS>
  <EQUIPPARAM>
   <EPCODE>YC1</EPCODE>
   <VALUE>1264</VALUE>
  </EQUIPPARAM></EQUIPPARAMS>
</EQUIP></data>
      </web:RequestEquipmentParam>
   </soapenv:Body>
</soapenv:Envelope>


[2019-12-09 14:07:37.208]# RECV ASCII>
HTTP/1.1 200 OK
Server: gSOAP/2.8
Content-Type: text/xml; charset=utf-8
Content-Length: 823
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://webservice.util.opc.zkzh.com/"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><ns1:RequestEquipmentParamResponse><return>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;EQUIP&gt;&#xA; &lt;EQUIPCODE&gt;EQ001&lt;/EQUIPCODE&gt;&#xA; &lt;EQUIPPARAMS&gt;&#xA;  &lt;EQUIPPARAM&gt;&#xA;   &lt;EPCODE&gt;gate_status_write&lt;/EPCODE&gt;&#xA;   &lt;VALUE&gt;32896&lt;/VALUE&gt;&#xA;  &lt;/EQUIPPARAM&gt;&#xA; &lt;/EQUIPPARAMS&gt;&#xA;&lt;/EQUIP&gt;&#xA;</return></ns1:RequestEquipmentParamResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

写报文交互报文
[2019-12-09 14:18:14.302]# SEND ASCII>
POST /OpcServer/ws/scadaws HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Content-Length: 563
Host: 192.168.0.199:8099
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.util.opc.zkzh.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:Equipments>
         <!--Optional:-->
         <data>  <?xml version="1.0" encoding="utf-8"?>
 <EQUIP> 
   <EQUIPCODE>EQ001</EQUIPCODE>  
   <EQUIPPARAMS> 
     <EQUIPPARAM> 
       <EPCODE>gate_status_write</EPCODE>  
       <VALUE>32896</VALUE> 
       </EQUIPPARAM>

   </EQUIPPARAMS> 

 </EQUIP></data>
      </web:Equipments>
   </soapenv:Body>
</soapenv:Envelope>


[2019-12-09 14:18:14.367]# RECV ASCII>
HTTP/1.1 200 OK
Server: gSOAP/2.8
Content-Type: text/xml; charset=utf-8
Content-Length: 479
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://webservice.util.opc.zkzh.com/"><SOAP-ENV:Header></SOAP-ENV:Header><SOAP-ENV:Body><ns1:EquipmentsResponse><return>1</return></ns1:EquipmentsResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

results matching ""

    No results matching ""