Java:复制捕获的请求

Java:复制捕获的请求,java,android,http,soap,request,Java,Android,Http,Soap,Request,我正在尝试复制一个由英特尔upnp开发工具堆栈生成的SOAP请求 使用设备嗅探器,我能够捕获以下请求 有人能告诉我复制这个的最简单方法是什么吗 数据包的来源: POST /_urn-upnp-org-serviceId-SwitchPower.0001_control HTTP/1.1 SOAPACTION: "urn:schemas-upnp-org:service:SwitchPower:1#SetTarget" CONTENT-TYPE: text/xml; charset="utf-8"

我正在尝试复制一个由英特尔upnp开发工具堆栈生成的SOAP请求

使用设备嗅探器,我能够捕获以下请求

有人能告诉我复制这个的最简单方法是什么吗

数据包的来源:

POST /_urn-upnp-org-serviceId-SwitchPower.0001_control HTTP/1.1
SOAPACTION: "urn:schemas-upnp-org:service:SwitchPower:1#SetTarget"
CONTENT-TYPE: text/xml; charset="utf-8"
HOST: 192.168.1.18:1451
Content-Length: 347

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"      xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
  <u:SetTarget xmlns:u="urn:schemas-upnp-org:service:SwitchPower:1">
     <newTargetValue>0</newTargetValue>
  </u:SetTarget>
</s:Body>
</s:Envelope>HTTP/1.1 200 OK
EXT: 
CONTENT-TYPE: text/xml; charset="utf-8"
SERVER: Windows NT/5.0, UPnP/1.0
Content-Length: 290

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"     xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <u:SetTargetResponse xmlns:u="urn:schemas-upnp-org:service:SwitchPower:1" />
  </s:Body>
</s:Envelope>
POST/\u urn-upnp-org-serviceId-SwitchPower.0001\u控制HTTP/1.1
SOAPACTION:“urn:schemas upnp org:service:SwitchPower:1#SetTarget”
内容类型:text/xml;charset=“utf-8”
主持人:192.168.1.18:1451
内容长度:347
0
HTTP/1.1200ok
提取:
内容类型:text/xml;charset=“utf-8”
服务器:Windows NT/5.0、UPnP/1.0
内容长度:290

一种简单的方法是在端口80上打开一个到系统的流,然后直接写出字符。你也可以通过这种方式得到回应。然而,这并不是实际处理任何返回内容的最佳方式。您可以通过发送普通请求,也可以在其中解释响应