mssoap30.dll

时间:2016-12-19 07:47:13
【文件属性】:

文件名称:mssoap30.dll

文件大小:493KB

文件格式:DLL

更新时间:2016-12-19 07:47:13

mssoap30

#include "stdafx.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; //你机器得安装SOAP Toolkit3.0 ,1.0时,用using namespace时报错 void query(char *EndPointURL,char *NameSpace,char *method,int argv_len,char* args[],char* argv[]) { ISoapSerializerPtr Serializer; ISoapReaderPtr Reader; ISoapConnectorPtr Connector; // Connect to the service Connector.CreateInstance(__uuidof(HttpConnector30)); Connector->Property["EndPointURL"] = EndPointURL;//"http://localhost/WebService1/Service1.asmx"; Connector->Connect();//和服务器连接 // Begin message Connector->Property["SoapAction"] = _bstr_t(NameSpace) + _bstr_t(method);//"http://xin.org/getIP"; Connector->BeginMessage(); Serializer.CreateInstance(__uuidof(SoapSerializer30)); // 将serializer连接到connector的输入字符串 Serializer->Init(_variant_t((IUnknown*)Connector->InputStream)); // 创建SOAP消息 Serializer->StartEnvelope("","",""); Serializer->StartBody(""); Serializer->StartElement(method,NameSpace,"","");//命名空间必须有 for(int i=0;iStartElement(args[i],NameSpace,"",""); Serializer->WriteString(argv[i]); Serializer->EndElement(); } Serializer->EndElement(); Serializer->EndBody(); Serializer->EndEnvelope(); // Send the message to the web service Connector->EndMessage(); // 读取响应 Reader.CreateInstance(__uuidof(SoapReader30)); // 将reader联接到connector的输出字符串 Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), ""); printf("Answer: %s\n",(const char*) Reader->RpcResult->text); } int main(int argc, char* argv[]) { CoInitialize(NULL); char *EndPointURL="http://approve.share-sun.com/SealService/Moblie/MyWebServices.asmx"; char *NameSpace="http://tempuri.org/"; char *method="GetSealInfo"; int argv_len= 2; // char * args[4] = {"logname","number","index","sealownerid"}; // char * argu[4] = {"njcs","5","1","12"}; char * args[2] = { "logname", "username"}; char * argu[2] = { "jiekou","南京测试"}; // char * args[2] = { "NumberOne", "NumberTwo"}; // char * argu[2] = { "1","2"}; // char * args[1] = { "str"}; // char * argu[1] = { "1"}; query(EndPointURL,NameSpace,method,argv_len,args,argu); CoUninitialize(); getchar(); return 0; }


网友评论

  • 可以使用,不错
  • 说道soap的话,我还是偏向MSSOAP。GSOAP生成的代码实在是太多了
  • 有一定的借鉴作用,最终使用了soap工具生成