1

I am developing a BlackBerry 10 apps with Cascades (C++ programming language) right now. Can anyone tell me how do i make a call to an ASP.NET web service in BlackBerry 10: Cascades? I'm just a beginner, so i don't really know anything. Thanks for your answer :D

4

1 回答 1

2

大多数 HTTP 通信是使用 Qt 中的 QNetworkRequest、QNetworkAccessManager 和 QNetworkReply 类完成的。要从 Web 服务获取响应,请遵循以下显示的代码段:

QNetworkAccessManager* netManager = new QNetworkAccessManager();
if (netManager) {

QUrl url(webServiceUrl);
QNetworkRequest req(url);

QNetworkReply* reply = netManager->get(req);
connect(reply, SIGNAL(finished()), this, SLOT(onReply()));
}

在 onReply 插槽中,您可以检查回复是否包含任何错误并解析响应。请注意,响应将采用 QByteArray 的形式,您可能需要转换为 QString 或您想要的形式。

有关更多信息,请遵循本教程

于 2012-10-17T11:54:23.337 回答