我有一个以太网到 1-Wire 接口,它会定期发送带有传感器数据的 HTTP 帖子。数据主体采用 XML 格式,但不是完全有效的 XML。我无法更改 HTTP 正文,因为它位于嵌入式软件中。完整的请求正文如下所示:
------------------------------3cbec9ce8f05
Content-Disposition: form-data; name="ServerData"; filename="details.xml"
Content-Type: text/plain
<?xml version="1.0" encoding="UTF-8"?>
<Devices-Detail-Response xmlns="http://www.example.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<PollCount>2739</PollCount>
<DevicesConnected>1</DevicesConnected>
<LoopTime>1.022</LoopTime>
<DevicesConnectedChannel1>0</DevicesConnectedChannel1>
<DevicesConnectedChannel2>0</DevicesConnectedChannel2>
<DevicesConnectedChannel3>1</DevicesConnectedChannel3>
<DataErrorsChannel1>0</DataErrorsChannel1>
<DataErrorsChannel2>0</DataErrorsChannel2>
<DataErrorsChannel3>0</DataErrorsChannel3>
<VoltageChannel1>4.91</VoltageChannel1>
<VoltageChannel2>4.92</VoltageChannel2>
<VoltageChannel3>4.92</VoltageChannel3>
<VoltagePower>5.16</VoltagePower>
<DeviceName>Unit 3 OW2</DeviceName>
<HostName>EDSOWSERVER2</HostName>
<MACAddress>00:00:00:00:00:00</MACAddress>
<DateTime>2018-12-12 16:44:48</DateTime>
<owd_DS18B20 Description="Programmable resolution thermometer">
<Name>DS18B20</Name>
<Family>28</Family>
<ROMId>F70000024D85E528</ROMId>
<Health>7</Health>
<Channel>3</Channel>
<RawData>C6004B467FFF0A102A00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000</RawData>
<PrimaryValue>12.3750 Deg C</PrimaryValue>
<Temperature Units="Centigrade">12.3750</Temperature>
<UserByte1 Writable="True">75</UserByte1>
<UserByte2 Writable="True">70</UserByte2>
<Resolution>12</Resolution>
<PowerSource>0</PowerSource>
</owd_DS18B20>
</Devices-Detail-Response>
------------------------------3cbec9ce8f05--
所以我试图在它到达动作方法之前删除'--------...'和Content-Type,以及最后的'--------..'。
慕的地6264312
qq_笑_17
相关分类