MSXML + SOAP TOOLKIT调用Web Service C++例子。
来源:互联网 发布:php cms 免费 编辑:程序博客网 时间:2024/05/16 14:34
#include <stdio.h>
#import "msxml4.dll"
using namespace MSXML2;
#import "C:/Program Files/Common Files/MSSoap/Binaries/mssoap30.dll" /
exclude("IStream", "IErrorInfo", "ISequentialStream", "_LARGE_INTEGER", /
"_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME")
using namespace MSSOAPLib30;
void Add()
{
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;
ISoapConnectorPtr Connector;
// Connect to the service.
Connector.CreateInstance(__uuidof(HttpConnector30));
Connector->Property["EndPointURL"] = "http://MyServer/Soap3DocSamples/DocSample1/Server/DocSample1.wsdl";
Connector->Connect();
// Begin the message.
//Connector->Property["SoapAction"] = "uri:AddNumbers";
Connector->Property["SoapAction"] = "http://tempuri.org/DocSample1/action/Sample1.AddNumbers";
Connector->BeginMessage();
// Create the SoapSerializer object.
Serializer.CreateInstance(__uuidof(SoapSerializer30));
// Connect the serializer object to the input stream of the connector object.
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
// Build the SOAP Message.
Serializer->StartEnvelope("","","");
Serializer->StartBody("");
Serializer->StartElement("AddNumbers","http://tempuri.org/DocSample1/message/","","");
Serializer->StartElement("NumberOne","","","");
Serializer->WriteString("5");
Serializer->EndElement();
Serializer->StartElement("NumberTwo","","","");
Serializer->WriteString("10");
Serializer->EndElement();
Serializer->EndElement();
Serializer->EndBody();
Serializer->EndEnvelope();
// Send the message to the XML Web service.
Connector->EndMessage();
// Read the response.
Reader.CreateInstance(__uuidof(SoapReader30));
// Connect the reader to the output stream of the connector object.
Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), "");
// Display the result.
printf("Answer: %s/n", (const char*)Reader->RpcResult->text);
}
int main()
{
CoInitialize(NULL);
Add();
CoUninitialize();
return 0;
}
- MSXML + SOAP TOOLKIT调用Web Service C++例子。
- 实例学习MS SOAP Toolkit 3.0 与 Web Service
- 在C++中使用soap toolkit访问Web Service
- Domino代理调用远程Web Service(SOAP)
- 纯SOAP动态调用Web Service API
- 在web service 中的android调用soap
- 使用Spring调用SOAP Web Service
- Java使用SOAP方式调用Web service
- asp 调用web service 例子
- CakePHP下利用soap协议实现web service的例子
- RO12 - RemObjects SDK调用已存在的SOAP Web Service
- c#调用delphi编写的SOAP Web Service(1)
- c#调用delphi编写的SOAP Web Service(2)
- 如何在waqs中调用soap web service
- Web Service Soap认证
- SOAP&Web Service
- WSDL & SOAP & Web Service
- SOAP and Web Service
- 冬季恋歌
- 音乐的下午
- 浮生. 缘聚
- 翩翩一叶舟 載不动许多愁
- 当沧海变为桑田
- MSXML + SOAP TOOLKIT调用Web Service C++例子。
- 微软广告称 Linux 运行成本高出 Windows 十倍
- 反思:中国不容乐观的工业化前景
- KDE 峰会:开源代码软件开发人员重视"易用性"
- JSP与Servlet
- 美国智库聚焦中国石油问题
- 有一种美丽叫放弃
- [生活] 领带的打法
- 听几米唱歌(三)