【发布时间】:2014-04-03 14:09:50
【问题描述】:
我想通过 C 调用 webservice。我不能使用任何现有的库。所以我在 Tomcat 端口 8080 上打开套接字(某些应用程序正在 Tomcat 上运行)。
我正在通过包含 SOAP 消息的套接字向 tomcat 发送 HTTP POST 请求。我能够调用 web 服务,但我无法接收以 SOAP 形式发送的数据。这是一个带有 SOAP 的 HTTP 请求,我通过套接字发送到 Tomcat
POST http://hostip.com:8080/APP/WebServiceName HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://www.companyname.com/webservices"
User-Agent: Jakarta Commons-HttpClient/3.1
Host: 192.168.50.151
Content-Length: length
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.company.com/webservices">
<soapenv:Header/>
<soapenv:Body>
<web:DataRequest>
<web:Scope>iOWNjuYroYC6HB</web:Scope>
<web:Source>
<web:ChildLine>
<web:ID>RnUNjuYroYC6HB</web:ID>
<web:Matrix>15</web:Matrix>
</web:ChildLine>
</web:Source>
<web:UserVariables>
<web:Variable>
<web:Key>Rule</web:Key>
<web:Value>Working</web:Value>
</web:Variable>
<web:Variable>
<web:Key>543</web:Key>
<web:Value>96</web:Value>
</web:Variable>
</web:UserVariables>
</web:DataRequest>
</soapenv:Body>
</soapenv:Envelope>
【问题讨论】:
-
欢迎来到 *.com。请花一些时间阅读the help pages,尤其是名为"What topics can I ask about here?" 和"What types of questions should I avoid asking?" 的部分。更重要的是,请阅读the Stack Overflow question checklist。您可能还想了解如何创建Minimal, Complete, and Verifiable example。
标签: c sockets http soap httprequest