#include <stdio.h>
//#include "windows.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.
if(FAILED(Connector.CreateInstance(__uuidof(HttpConnector30)))) //创建对象
{
printf("失败");
}
Connector->Property["EndPointURL"] ="http://192.168.3.174:8080/UserMgrService/UserInfoPort?wsdl"; //wsdl路径
Connector->Connect();
// Begin the message. //消息体
//Connector->Property["SoapAction"] = "http://192.168.3.174:8080/UserMgrService/UserInfoPort?wsdl"; //函数体参数
//Connector->BeginMessage();
Serializer.CreateInstance(__uuidof(SoapSerializer30));
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
// Build the SOAP Message.
Serializer->StartEnvelope("Soap","","");
Serializer->StartBody("");
Serializer->StartElement("GetUserInfo","http://Services.Jason.TSD/","","Soap"); //函数处理
Serializer->StartElement("mobileCode","","","Soap");
Serializer->WriteString("18915038959"); //参数处理
Serializer->EndElement();
Serializer->EndElement();
Serializer->EndBody();
Serializer->EndEnvelope();
Connector->EndMessage();
Reader.CreateInstance(__uuidof(SoapReader30));
printf("here");
Reader->Load(_variant_t((IUnknown*)Connector->OutputStream),""); //加载返回数据
// Display the result.
//printf("Answer:%s\n", (const char*)Reader->Body->xml);
printf("Answer:%s\n",(const char*)Reader->RpcResult->text);
}
int main()
{
CoInitialize(NULL);
Add();
CoUninitialize();
return 0;
}
vc6.0调用webservice
5星 · 超过95%的资源 需积分: 5 44 浏览量
2013-04-11
16:02:13
上传
评论 3
收藏 1.7MB RAR 举报
一朵傲娇的奇葩
- 粉丝: 1
- 资源: 10
- 1
- 2
前往页