VC 通过HTTP调用webservice请求数据
CHttpFile *pFile = m_pHttp->OpenRequest(CHttpConnection::HTTP_VERB_POST,
"/HelloWorldService/services/HelloWorld.asmx", NULL, 0, NULL, NULL, m_dwHttpRequestFlags);
pFile->AddRequestHeaders("Content-Type: text/xml; charset=utf-8", HTTP_ADDREQ_FLAG_ADD);
pFile->AddRequestHeaders("SOAPAction: \"http://tempuri.org/exampleMessage\"", HTTP_ADDREQ_FLAG_ADD);
strData += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
strData += "\r\n<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
strData += "\r\n\t<soap:Body>";
strData += "\r\n\t\t<exampleMessage xmlns=\"http://tempuri.org/\">";
strData += "\r\n\t\t\t";
strData += SetXmlSection("in0", "hello", szXmlData);
strData += "\r\n\t\t";
strData += "</exampleMessage>";
strData += "\r\n\t</soap:Body>";
strData += "\r\n</soap:Envelope>";
webservice是我用java在tomcat上写的一个exampleMessage接口,但是调用的时候没有放回自己要的数据?请教高手如何解决这个问题?
java的webservice接口是http://localhost:8080/HelloWorldService/services/HelloWorld.asmx,里面有一个接口是exampleMessage 接受一个string参数。
"/HelloWorldService/services/HelloWorld.asmx", NULL, 0, NULL, NULL, m_dwHttpRequestFlags);
pFile->AddRequestHeaders("Content-Type: text/xml; charset=utf-8", HTTP_ADDREQ_FLAG_ADD);
pFile->AddRequestHeaders("SOAPAction: \"http://tempuri.org/exampleMessage\"", HTTP_ADDREQ_FLAG_ADD);
strData += "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
strData += "\r\n<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">";
strData += "\r\n\t<soap:Body>";
strData += "\r\n\t\t<exampleMessage xmlns=\"http://tempuri.org/\">";
strData += "\r\n\t\t\t";
strData += SetXmlSection("in0", "hello", szXmlData);
strData += "\r\n\t\t";
strData += "</exampleMessage>";
strData += "\r\n\t</soap:Body>";
strData += "\r\n</soap:Envelope>";
webservice是我用java在tomcat上写的一个exampleMessage接口,但是调用的时候没有放回自己要的数据?请教高手如何解决这个问题?
java的webservice接口是http://localhost:8080/HelloWorldService/services/HelloWorld.asmx,里面有一个接口是exampleMessage 接受一个string参数。
...全文
相关推荐
VC++(MFC)中WebService服务的调用
在VC++(MFC)中调用WebService服务是一项常见的任务,尤其在开发企业级应用程序时。
VC通过HttpGet和HttpPost方式与WebService通信,解析返回的Json
HttpPost则可以携带大量数据,包括在请求体中,适合上传文件或发送复杂的数据结构,比如Json格式的数据。WebService是一种基于HTTP协议的服务,可以提供跨平台的数据交换能力。
商业编程-源码-在VC中调用 WebService.zip
然后,你可以使用HTTP POST方法将这个XML请求发送到WebService的URL。4. **HTTP客户端库**:VC提供了WinInet库,可以用来实现HTTP通信。
vc6.0调用webservice的方法
#### VC6.0调用WebService的步骤为了在VC6.0中调用WebService,我们需要按照以下步骤来进行:1.
VC++写的,调用webservice获取天气的小程序
它使用XML(可扩展标记语言)来交换数据,并通过HTTP协议传输,使得不同操作系统和编程语言之间的互操作性成为可能。在这个案例中,VC++程序通过调用WebService接口来获取天气预报数据。3.


网络编程
