Symbian学习笔记(18)——初探WebServices API的使用(中)
http://tech.ddvip.com 2008年09月06日 社区交流
内容摘要:继续刚才的,现在来看具体代码,先是ConnectL的实现:
继续刚才的,现在来看具体代码,先是ConnectL的实现:
view plaincopy to clipboardprint?
voidCWebEngine::ConnectL()
{
CSenXmlServiceDescription*pattern=CSenXmlServiceDescription::NewLC();
pattern->SetFrameworkIdL(KDefaultBasicWebServicesFrameworkID);
pattern->SetEndPointL(KWSEndPoint);
deleteiConnection;
iConnection=NULL;
iConnection=CSenServiceConnection::NewL(*this,*pattern);
CleanupStack::PopAndDestroy(pattern);
}
void CWebEngine::ConnectL()
{
CSenXmlServiceDescription* pattern = CSenXmlServiceDescription::NewLC();
pattern->SetFrameworkIdL(KDefaultBasicWebServicesFrameworkID);
pattern->SetEndPointL(KWSEndPoint);
delete iConnection;
iConnection = NULL;
iConnection = CSenServiceConnection::NewL(*this, *pattern);
CleanupStack::PopAndDestroy(pattern);
}
这里注意一点与那个AddressBook例子不同的是我们声明了不同框架类型是KDefaultBasicWebServicesFrameworkID,并且这样只需要提供EndPoint而不需要Contract了。KWSEndPoint的值是在CPP前声明了:_LIT8(KWSEndPoint,"http://192.168.0.201/uim/PService.asmx");
CSenServiceConnection::NewL的两个参数,一是自己(即MSenServiceConsumer)负责处理回调,二是一个CSenXmlServiceDescription负责参数配置。
在回调SetStatus中我只是简单地打印出状态值。
来源:SHARE & TOP 责编:豆豆技术应用