调用WebService的问题
按照网上的例子,自己用S60自带的API写了访问WebService的代码
void CWebEngine::HandleErrorL(const TInt aErrorCode,const TDesC8& aError)
{
const TDesC8& error=aError;
const TInt code=aErrorCode;
}
void CWebEngine::ConnectL()
{
CSenXmlServiceDescription* pattern = CSenXmlServiceDescription::NewLC();
pattern->SetFrameworkIdL(KDefaultBasicWebServicesFrameworkID);
pattern->SetEndPointL(_L8("http://webservice.webxml.com.cn/WebServices/WeatherWebService.asmx"));
delete iConnection;
iConnection = NULL;
iConnection = CSenServiceConnection::NewL(*this, *pattern);
CleanupStack::PopAndDestroy(pattern);
}
void CWebEngine::SayHello()
{
//send
CSenSoapEnvelope *env = CSenSoapEnvelope::NewL();
CleanupStack::PushL(env);
env->SetSoapActionL(_L8("http://WebXml.com.cn/getSupportProvince"));
CSenElement& request=env->BodyL().AddElementL(_L8("http://WebXml.com.cn/"), _L8("getSupportProvince"));
//CSenElement& userName = request.AddElementL(_L8("userName"));
//userName.SetContentL(_L8("Test"));
//CSenElement& loginPassword = request.AddElementL(_L8("loginPassword"));
//loginPassword.SetContentL(_L8("Test"));
iConnection->SendL(*env);
CleanupStack::PopAndDestroy(env);
}
CWebEngine* engine=CWebEngine::NewL();
engine->ConnectL();
engine->SayHello();
const TInt KErrSenInternal = -30297;
const TInt KErrSenNoEndpoint = -30298;
const TInt KErrSenNoContract = -30299;
const TInt KErrSenProviderIdInUseByAnotherEndpoint = -30305;
const TInt KErrSenNoContractNoEndPoint = -30306;
const TInt KErrSenBrokenSoapEnvelope = -30307;
const TInt KErrSenBrokenSoapFault = -30308;
const TInt KErrSenCancelled = -30309;