WINCE 调用CoCreateInstance出现没有注册类别

wnqgz 2011-02-18 10:27:38
最近想做一个通过PDA上传文件的程序,可是我用wince调用CoCreateInstance时出现“没有注册类别”的提示,不知道哪位大侠知道怎么解决这个问题呢,这个已经困惑了我好几天了.一下是我实现的程序代码!
在.CPP中添加
try
{
HRESULT hr=CoInitializeEx(NULL,COINIT_MULTITHREADED);

// 与Web服务连接
HRESULT hr1=Connector.CreateInstance(__uuidof(SoapConnectorFactory));
//HRESULT hr1=Connector.CreateInstance(__uuidof(HttpConnector));
// http://localhost/MyWeb/Service.asmx?op=StringsAdd为调用页面
//Connector->Property["EndPointURL"] = "http://localhost/MyWeb/Service.asmx?op=StringsAdd";
Connector->Property[_T("EndPointURL")] =_T("http://localhost:1329/WebSite2/Service.asmx?op=StringsAdd") ;

Connector->Connect();

// 开始消息,http://tempuri.org/StringsAdd为响应函数,
Connector->Property[_T("SoapAction")] = _T("http://tempuri.org/StringsAdd");

Connector->BeginMessage(); //启动消息句柄

// 创建SoapSerializer对象
Serializer.CreateInstance(__uuidof(SoapSerializer));
//将 serializer 连接到 connector 的输入字符串
Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
//////////////////////

// 创建SOAP消息
Serializer->startEnvelope(_T("soap"),_T(""),_T(""));
Serializer->startBody(_T(""));
// 找到WEB函数名
Serializer->startElement(_T("StringsAdd"),_T("http://tempuri.org/"),_T(""),_T(""));
// 找到第一个参数
Serializer->startElement(_T("strLeft"),_T("http://tempuri.org/"),_T(""),_T(""));
// 输入第一个参数值
Serializer->writeString(_T("Hello,"));
Serializer->endElement();
// 找到第二个参数
Serializer->startElement(_T("strRight"),_T("http://tempuri.org/"),_T(""),_T(""));
// 输入第二个参数值
Serializer->writeString(_T("World!"));
Serializer->endElement();

Serializer->endElement();
Serializer->endBody();
Serializer->endEnvelope();

//将该消息发送给web服务
Connector->EndMessage(); //将消息送往服务器
//读取响应
Reader.CreateInstance(__uuidof(SoapReader));
//将reader联接到connector的输出字符串
Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), "");
//显示结果
//AfxMessageBox((const char *)Reader->Body->xml);//以xml格式输出
CString str=Reader->Body->xml;
MessageBox(str);

}
catch (_com_error e)
{
MessageBox(e.ErrorMessage());
//return (CString)(char*)e.Description();
return ;
}
///////////////////////////////
在.h中添加
#import "msxml4.dll"
#include <objsafe.h>
// #include <msxml2.h>
// #include <ocidl.h>
using namespace MSXML2;
#import "C:\Program Files\Common Files\MSSoap\Binaries\MSSOAP1.dll" \
exclude("IStream", "IErrorInfo", "ISequentialStream", "_LARGE_INTEGER", \
"_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME")
using namespace MSSOAPLib;
////////////////////////////////////////////
及在.h的类中添加
ISoapConnectorPtr Connector;
//ISoapConnectorPtr SoapConnector;
ISoapSerializerPtr Serializer;
ISoapReaderPtr Reader;





求高手解决!!!!!
...全文
407 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
linuxshy 2011-07-29
  • 打赏
  • 举报
回复
这个问题表示关注
91program 2011-02-18
  • 打赏
  • 举报
回复
#import "C:\Program Files\Common Files\MSSoap\Binaries\MSSOAP1.dll" ???

CE下不能使用PC上的DLL
wnqgz 2011-02-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 91program 的回复:]
#import "C:\Program Files\Common Files\MSSoap\Binaries\MSSOAP1.dll" ???

CE下不能使用PC上的DLL
[/Quote]
CE中不能使用PC上的DLL,那怎么办呢?ce中如何调用web服务呢?我是用c++语言开发的!ce中用C#语言调用web服务很好实现,可是用C++我就不太明白了,请高手赐教!!谢谢……
wnqgz 2011-02-18
  • 打赏
  • 举报
回复
CE中不能使用PC上的DLL,那怎么办呢?ce中如何调用web服务呢?我是用c++语言开发的!ce中用C#语言调用web服务很好实现,可是用C++我就不太明白了,请高手赐教!!谢谢……

19,502

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 嵌入开发(WinCE)
社区管理员
  • 嵌入开发(WinCE)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧