S.l.e!ep.¢%

像打了激速一样,以四倍的速度运转,开心的工作
简单、开放、平等的公司文化;尊重个性、自由与个人价值;
posts - 1098, comments - 335, trackbacks - 0, articles - 1
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

//WEB_SERVICE      #import   "msxml3.dll"        using   namespace   MSXML2;        #import   "C:\Program   Files\Common   Files\MSSoap\Binaries\MSSOAP1.dll"   exclude("IStream",   "ISequentialStream",   "_LARGE_INTEGER","_ULARGE_INTEGER",   "tagSTATSTG",   "_FILETIME")        using   namespace   MSSOAPLib;        //END           CString   BeginSoap(CString   UserName,CString   Password,CString   WebUrl);      ISoapConnectorPtr   SoapConnector;      ISoapSerializerPtr   Serializer;      ISoapReaderPtr   Reader;           CString   CXXXXXXXDlg::BeginSoap(CString   UserName,CString   Password,CString   WebUrl)      {      HRESULT hr;           CString   theSoapBody;           theSoapBody.Format(_T("<soap:Body><GetCSLoginTickets   xmlns=\"http://tempuri.org/\"><LogonName>%s</LogonName><Pwd>%s</Pwd></GetCSLoginTickets></soap:Body>"),UserName,Password);                //创建SoapConnector类的对象      SoapConnector.CreateInstance(__uuidof(HttpConnector));             //指定Web服务的地址      SoapConnector->Property   ["EndPointURL"]   =(LPSTR)(LPCTSTR)WebUrl;           //与Web服务连接      hr=SoapConnector->Connect();      if(FAILED(hr))   return   NULL;           //指定Web服务完成的操作      SoapConnector->Property   ["SoapAction"]   =   _T("http://tempuri.org/GetCSLoginTickets");           //准备发送消息给Web服务      SoapConnector->BeginMessage();           //   创建SoapSerializer对象      Serializer.CreateInstance(__uuidof(SoapSerializer));             //   将serializer连接到connector的输入字符串      Serializer->Init(_variant_t((IUnknown*)SoapConnector->InputStream));             //   创建SOAP消息              Serializer->startEnvelope("soap","NONE","");                    Serializer->SoapNamespace("xsi","http://www.w3.org/2001/XMLSchema-instance");              Serializer->SoapNamespace("xsd","http://www.w3.org/2001/XMLSchema");           Serializer->writeXML((LPSTR)(LPCTSTR)theSoapBody);                   Serializer->endEnvelope();                 //消息真正地发给Web服务      hr=SoapConnector->EndMessage();        if(FAILED(hr))   return   NULL;           //   读取响应      Reader.CreateInstance(__uuidof(SoapReader));             //   将reader联接到connector的输出字符串      Reader->Load(_variant_t((IUnknown*)SoapConnector->OutputStream),   _T(""));                  return   CString((const   char   *)Reader->RPCResult->text);           }

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhanghefu/archive/2008/06/23/2579529.aspx


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理