using WebService - json

1. I need to load data

import bb.cascades 1.0import bb.data 1.0Page { content: ListView { id: listView dataModel: dataModel //... } attachedObjects: [ GroupDataModel { id: dataModel }, DataSource { id: dataSource source: "http://192.168.1.251:410/Mobile/Service1.svc/english/Category?CountryID=1" onDataLoaded: { dataModel.insertList(data) } } ] onCreationCompleted: { dataSource.load();  }}

1. QML FILE

import bb.cascades 1.0import bb.data 1.0
Page { content: Container { layout: StackLayout { orientation: LayoutOrientation.TopToBottom

 }

 TextField { id: countryID hintText: "Enter Country ID eg:'1'"  maxWidth: 400 verticalAlignment: VerticalAlignment.Center horizontalAlignment: HorizontalAlignment.Center textStyle.textAlign: TextAlign.Center
}

 Button { id: btn

 text: "Send JSON Request" onClicked: { app.sendRequest(countryID.text);

 } verticalAlignment: VerticalAlignment.Center horizontalAlignment: HorizontalAlignment.Center }

 }}
 

2 FILE OF THE HPP

// Default empty project template#ifndef CALCI_HPP_#define CALCI_HPP_
#include 

namespace bb { namespace cascades { class Application; }}

class controller : public QObject{ Q_OBJECTpublic: controller(bb::cascades::Application *app);

public Q_SLOTS: void sendRequest(const QString &countryID);

private Q_SLOTS:
void onFinished();
};

#endif
 

3 CPP FILE

 

// Default empty project template#include "calci.hpp"
#include #include #include #include #include #include #include #include 
using namespace bb::cascades;using namespace bb::data;
controller::controller(bb::cascades::Application *app): QObject(app){
QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this); qml->setContextProperty("app", this);
AbstractPane *root = qml->createRootObject();
app->setScene(root);}

void controller::sendRequest(const QString &countryID){
QNetworkAccessManager* networkAccessManager = new QNetworkAccessManager(this);
const QString queryUri = QString::fromLatin1("http://192.168.1.251:410/Mobile/Service1.svc/english/Category?CountryID=%1").arg(countryID);
QNetworkRequest request(queryUri);
QNetworkReply* reply = networkAccessManager->get(request);
bool ok = connect(reply, SIGNAL(finished()), this, SLOT(onFinished())); Q_ASSERT(ok); Q_UNUSED(ok);}

void controller::onFinished(){ QNetworkReply* reply = qobject_cast(sender()); QString response; if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 200) { JsonDataAccess jda; QVariantMap map = jda.loadFromBuffer(reply->readAll()).toMap();
QVariantList addresses = map["GetCategoryResult"].toList();
foreach(QVariant var, addresses) { QVariantMap addressMap = var.toMap();
qDebug() << "CategoryName is " << addressMap["CategoryName"].toString(); qDebug() << "CategoryID is " << addressMap["CategoryID"].toString(); } } else { qDebug() << "Server returned code " << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); } }

Finally I got the result for json web service

 

Tags: BlackBerry Developers

Similar Questions

  • How to create and use Webservice using WSDL controls in weblogic portal10.3

    I have WSDL, how to create webservice control using WSDL in portal weblogic 10.3 and use these controls to call the Web service methods?
    Please give me the links of documents for this.

    Thank you

    Published by: user9041086 on August 12, 2010 09:26

    See the discussion below

    How to create and use Webservice using WSDL controls in weblogic portal10.3

    Thank you
    Vincent Sarvabatla

  • To Webservice JSON string validation

    Hi, I am a beginner, Blackberry developer and I would like help JSON string to a report Web service. I currently have the php pages that accept data in JSON format. Is there a way to do this? Any help would be appreciated. Thank you.

    Hello

    > showing the JSON string to a webservice

    give this to start reading:

    http://supportforums.BlackBerry.com/T5/Cascades-development-knowledge/using-XMLHttpRequest-from-QML-...

    g

  • How to use a json file to animate a bar graph?

    I am very new to javascript, so forgive me if my terminology is bad.

    I created a json file with all the data in a bar chart.

    How can I to sequelae in order to analyze the data and use it to drive my animations?

    Thanks, I can give some examples of my text json and capture screen of my histogram if necessary.

    That will require script. I propose your questions on this forum of sup: after effects Scripting

    The other option is to buy an existing script: http://aescripts.com/infocharts-creator/

    Unless you have a lot of them to do on an ongoing basis, it would be probably faster to just do animations by hand.

  • How to integrate WebCenter content using WebServices

    Hi all

    I have only been exposed to the WebCenter content for a little while and want to integrate with it using WebServives - what I understand is that if you use services Web (WSDL) there is a configuration that needs to happen on the side Toilet content and especially around security. Right now I'm testing just the services our SOAP_UI - Ive used this link http://hostname:16200/cs/idcplg? wsdl


    I tried watching a WSDl in a browser, but nothing appears... Can someone Guide and help me on this?


    Thank you

    Hi thanks! I succeeded with that - basically ended use RIDC and created her Web services. I also got the normal work of webservices.

  • Using webServices and Interactive instruction

    I would like to know how can I know how to create an Interactive instruction that uses a Web service.

    I can't find anything useful about it on the internet or official documentation...

    Any help?

    Kind regards!

    It is the same whether inside a statement Interactive or not, the use of a Web service in Flex:

    Step 1. Find a Web service that you want to use.

    (Here's a link public wsdl for test/proof of concept: http://www.webservicex.net/WeatherForecast.asmx?WSDL )

    Step 2. Use, as shown in this example: http://www.cflex.net/showFileDetails.cfm?ObjectID=582

    More information on how to use the Flex webservices:

    This http://TV.adobe.com/watch/Flex-in-a-Week-Day-2/Retrieving-and-Handling-Data-using-webservi.

    http://blogs.4Point.com/Brad.White/2008/12/4-ways-to-invoke-a-WebService-in-Flex-with-MXML - and - actionscript.html

    class ebservice http://blog.flexexamples.com/2008/04/14/Calling-a-simple-Web-service-from-Flex-using-the-w.

    It will be useful,

    Oana

  • Customized using WebService authentication

    Hello
    I am trying to create a way to authenticate my users after the call to a Web service using authentication custom so that they have no newspaper twice (SSO).
    Here is a brief description of what I'm trying to do:

    -End users and get authenticated in an iPlanet Portal Login.
    -Once in - they hit a link that calls my APEX application in a new window.
    -J' I call the Web Service that returns a response telling me that if they have a valid session of portal with username etc.
    S ' they are connected to our portal - I authenticate by their SUMMIT with custom authentication and allow them to continue.

    I've done so far:
    -Created a process of footer after the Login (101) Page that calls the Web Service.
    -Creates automatically a Page submit on page 101 with Javascript.
    -Changed after submit process 'Username Cookie Set' use the connection is returned in the Web Service.
    -Changed after submit process 'Login' to use the connection is returned in the Web Service.
    -Custom authentication is performed once the Page is sent.
    -L' user can then run the Application.

    Everything worked very well when I was already connected to the APEX as a developer, but when I tried to run the application as a non-developer I get the error:
    ORA-01400: cannot insert NULL into ("FLOWS_030100". «WWV_FLOW_COLLECTIONS$ '.» (' ' USER_ID ')

    Now, I realize that my Webservice process tries to store the result of the Web Service call until the connection has occurred - so there is no APEX users at this stage.

    Someone at - it a way to accomplish what I'm doing?

    Thank you
    Bill

    Bill,

    To determine whether a valid session, I have to call the Web Service - where I provide the ID of session as an input parameter.

    Well, then you will need to code a PL/SQL function to do this.

    Then I ask the wwv_flow_collections view to retrieve the user name and a Boolean value to tell me if this is a session valid portal.

    Where to get filled this collection?

    Did I miss something related to the solution of ntlm?

    Do not confuse this solution "ntlm" as one who is related to NTLM, in itself. It is generic.

    Do you know if it is possible to call a Web Service and retrieve the response without storing the answer in a collection?

    I don't know anything, but I do not know how a collection is used in your current implementation.

    Scott

  • Using webservices to archive files to the Complutense University of MADRID

    Hi all.

    We are trying to perform some tests to the Complutense University of MADRID, but we do not see many examples on this subject.
    That's what we want to do:

    We want to use Web services for archiving of files at the Complutense University of MADRID.

    How?

    1. we will develop a java application
    2 inside of the application, there will be a button that calls the Web service
    3 after the Web service is called, the document should go outside UCM

    So far, I only do research. Read the documents on Web services, how they work and what I could find.
    But I can't find an example about this. Someone, please, I could tell where I can find it?

    Thanks for your help and your patience.

    Fernando

    Just in case someone was looking for a code example, I created one:

                Stub stub = (Stub)client.getPort();
                stub._setProperty(stub.USERNAME_PROPERTY, "weblogic");
                stub._setProperty(stub.PASSWORD_PROPERTY, "welcome1");
    
                IdcPropertyList ipl = null;
                IdcFile primaryFile = new IdcFile();
                File f = new File ("C:/temp/test.doc");
    
                primaryFile.setFileName(f.getName());
                primaryFile.setFileContent(CheckInSoapPortClient.getBytesFromFile(f));
    
                //client.checkInUniversal(dDocName, dDocTitle, dDocType, dDocAuthor, dSecurityGroup, dDocAccount, CustomDocMetaData, primaryFile, alternateFile, extraProps)
                CheckInUniversalResult result = client.checkInUniversal("", "Checked-in via WS call", "Document", "weblogic", "Public", "", ipl, primaryFile, null, null);
    
                System.out.println(result.getStatusInfo().getStatusMessage());
    

    All I needed was the CheckIn.wsdl and JDev (I created a Web Service Proxy, he gave the WSDL file and added in the code above to an auto-generated Java).

  • problem with combobox Countrylist display using webservice

    Hi, I am very new to flex, I am trying to display countrylist in ComboBox but it does not, Pls guide me with your ideas, I give request Web service thorugh my service works correctly I tested, 100%

    Flex Code:

    [Bindable]
    private var Country_arrlst:Array;
    public function creationComplete (): void
    {
    userRequest.getCountries ();
    }

    private void remotingCountryHandler(event:ResultEvent):void {}

    Country_arrlst = new Array (event.result as Array);
    Country_arr = new ArrayCollection (Country_arrlst);
    }
    []] >

    < / mx:Script >
    " < mx:WebService id ="userRequest"wsdl =" http://localhost: 8080/axis/services/flexdemo1? wsdl ">

    "< name mx:operation ="getCountries' fault = "mx.controls.Alert.show (event.fault.faultString)" result = "remotingCountryHandler (event)" / >

    < / mx:WebService >
    < mx:ArrayCollection id = "Country_arr".
    source = "MX.utils.ArrayUtil.ToArray (userRequest.GetList)" / >
    <! - user interface - >
    < mx:VBox id = "hb1" borderStyle = "solid" width = "100%" height = "100%" backgroundColor = "white" >
    < mx:Panel title = "Transaction search form" fontSize = "12" color = "black" fontWeight = "bold" fontFamily = "Arial" width = "100%" height = "100%" >
    < mx:Canvas borderStyle = "solid" width = "100%" height = "100%" >
    < mx:Label text = "' country: ' x '20' = y ="110"/ >"
    < mx:ComboBox id = 'countrylist"dataProvider ="{Country_arr}"x ="94"y ="107"height ="24"width ="202"/ >
    < / mx:Canvas >
    < / mx:Panel >
    < / mx:VBox >
    < / mx:Application >

    Hello

    FIX: you array collection:

    private var Country_arr:ArrayCollecion = new ArrayCollection collection;

    private void remotingCountryHandler(event:ResultEvent):void {}
    Country_arr = ArrayCollection (event.result);
    }

    Set the label to drop-down list with the name of the data field.

    Let me know

    Johnny

    Please rate answers

  • How to get an output of HcmDataLoader using webservice

    Hi, I introduced web-service HcmDataLoader and back me a task ID. Now, I want to call a new service, that may take ESS Job ID (or content-id) as input and provide me with information on the number of records have been imported/load successfully. All failed, and what is the reason.

    Is there a service that can provide me with this information.

    If no service, can you please suggest some tables, which I can query for more information.

    Thank you

    Sanjeev.

    Hello

    I'm not sure service to retrieve the details of job HDL, but you can access it from table and diagnostic framework. Please check this post,

    I hope this helps.

    Kind regards

    Pawan

  • How to show my listview QML this JSON webservice

    Hi all

    IM new developer for blackberry 10

    It's my first project of construction of a PSA

    I want to ask

    1. This is my JSON www.rws.rajaspot.com/rs_promoclient.php

    2. I want to do a listview in my QML using this JSON

    y at - it a code for this example, I tried to make the market http://stackoverflow.com/questions/18598886/how-to-use-json-webservice-in-blackberry-cascades and http://stackoverflow.com/questions/18638067/how-to-create-listview-for-json-parsing-in-blackberry-ca... but still get error

    Please help, thanks

    Did you add this line to your .pro file...

    LIBS +=-lbbdata

  • Mobile applications - target component using the component of reference - JSON is not defined in the scope

    Application based Mobile Apps to integrate angular with AEM and transfer data to angular range of AEM using angular.json.jsp and controller.js.jsp. When I am using this standalone as a component and drag to the page that is based on the angular model. The JSON created in angular.json.jsp is readable in controller.js.jsp with "frameworkType = angular.

    When this component is written in another page, in another page trying to use within the reference element, the angular.json.jsp, controller.js.jsp does not come to the image at all.

    I had a use case to create the JSON structure (to go to angular range) in one place, then all pages using the reference component. Pointers would be useful

    Hi Sandeep,

    The best recommendation I can offer at this point is to create an extension of the component/libs/foundation/components/reference that includes the node of cq: model by specifying frameworkType: angular and supports transmission by proxy of applications angular.json and controller.js to the resource "referenced". I've hacked together an example of component to prove:

    Mobile reference component example · GitHub

    Hope this helps,

    Bruce

  • How to post JSON using the Oracle Data Service remains

    I use the regular (not NoSQL or something) oracle database with oracle rest data service. Now I need to post data / put wrote in the body of the request using some json/xml format, how to consume them using the rest data service, searching inside the express application?  important: using pl/sql block

    Also, I am on,

    Data service Oracle rest 3.0

    Oracle Application Express 4.2

    Post edited by: Jacynthe

    OK, I got the answer. At the express request, there is a link called body variable (: body in BLOB). but the BLOB data type. So, we have to convert that in other data, type what we in pl/sql. I've converted data type witch CLOB supports json.

  • using the Webservices primavera createProject function

    Hello

    I'm trying to make the integration between primavera and unifier via webservices

    I use Eclipse IDE to call the function of these two Web application services.

    To unify webservices, I added a client in Eclipse and I used the function getProjectshellLIst in which I give the parameters and get the result in XML format

    but the issue I'm facing is when I try to use the function createProject primavera in Eclipse
    It asks me createProjects (createProjects16) which is a class, but I don't know where I should give the required parameters so that the project is created in the primavera

    Please help me with it or provide another option, that I can use to integrate them using webservices

    Hi, I tried your code and code below works for me;

    Please do not forget to sheck P6 Web service settings: http://host:port/p6/admin.jsp

    Demo.Java

    package com.prm;

    to import java.net.MalformedURLException;

    import java.net.URL;

    import java.util.ArrayList;

    import java.util.HashMap;

    import java.util.List;

    import java.util.Map;

    Import org.apache.cxf.frontend.ClientProxy;

    Import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;

    Import org.apache.ws.security.WSConstants;

    Import org.apache.ws.security.handler.WSHandlerConstants;

    import com.primavera.ws.p6.activity.Activity;

    import com.primavera.ws.p6.activity.ActivityFieldType;

    import com.primavera.ws.p6.activity.ActivityPortType;

    import com.primavera.ws.p6.activity.ActivityService;

    import com.primavera.ws.p6.activity.IntegrationFault;

    public class Demo {}

    Public Shared Sub main (String [] args) throws IntegrationFault, MalformedURLException {}

    WsdlURL URL = new URL ("http://Host" + ACTIVITY_SERVICE);

    ActivityService service = new ActivityService (wsdlURL);

    ActivityPortType port = service.getActivityPort ();

    customer org.apache.cxf.endpoint.Client = ClientProxy.getClient (port);

    org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint ();

    Map: outProps = new HashMap();

    outProps.put (WSHandlerConstants.ACTION, "UsernameToken Timestamp");

    outProps.put (WSHandlerConstants.USER, "admin");

    outProps.put (WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);

    outProps.put (WSHandlerConstants.USERNAME_TOKEN, ClientPasswordCallback.class.getName ());

    outProps.put (WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordCallback.class.getName ());

    Set the properties on the interceptor

    WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor (outProps);

    cxfEndpoint.getOutInterceptors () .add (wssOut);

    List listechamps = new ArrayList();

    fieldList.add (ActivityFieldType.fromValue ("Id"));

    fieldList.add (ActivityFieldType.fromValue ("RemainingDuration"));

    String filter = "Id = 'A1000" ";

    List actList = port.readActivities (filter, fieldList, null);

    for (activity Act: actList) {}

    System.out.println ("Activity ObjectId Is" + act.getObjectId ());

    System.out.println ("Activity RemainingDuration is" + act.getRemainingDuration () .getValue ());

    }

    }

    public static final String ACTIVITY_SERVICE = "/ p6ws/services/ActivityService? WSDL ";

    }

    ClientPasswordCallback.java

    package com.prm;

    import java.io.IOException;

    javax.security.auth.callback.Callback import;

    javax.security.auth.callback.CallbackHandler import;

    Import javax.security.auth.callback.UnsupportedCallbackException;

    Import org.apache.ws.security.WSPasswordCallback;

    / public class ClientPasswordCallback implements CallbackHandler {}

    @Override

    public void handle (callback [] arg0) survey IOException,

    {UnsupportedCallbackException}

    PC WSPasswordCallback (WSPasswordCallback) = arg0 [0];

    pc.setPassword ("passwd");

    }

    }

  • I used my old firefox data and now he has bugged.

    My problem started after I deleted my profile. Not knowing what I was doing, I deleted my profile and restarted Firefox. I have had no Favorites, my theme had disappeared, etc.. After awhile, I realized how to use my old data from Firefox to retrieve my old profile. When I did this, I think I could go back to an older version of Firefox, but it says that everything is up-to-date. The problem is that when I go to some sites, it is said there is a buggy script (or loads very slow) and I have to stop the script while it is running. Another thing is that when I go to some Web sites (it varies on how many times it happens), it says that I have to update my Media Player. So I got the link and it automatically stops a .exe. I have a mac and that you can not use an exe file (don't tell me to use bootcamp, I don't have a big enough flash drive). When I just go on the web, it's the same thing. If it must operate only with Microsoft, so how do I stop the banner to appear?

    Thanks for the help and if you could not, thanks for trying.

    Maybe create a new profile and be more careful to recover data from an old profile.

    You can use a JSON backup in the bookmarkbackups folder to restore the bookmarks.

    You can transfer these files into the old data of Firefox on the desktop folder to retrieve specific data from your previous profile.

    • bookmarks/history: backups in the bookmarkbackups folder and perhaps places.sqlite, if you really need the history
    • other SQLite files cookies.sqlite (cookies) and formhistory.sqlite (saved form data)
    • logins. JSON and key3db for passwords in password manager
    • Permissions.SQLite and, possibly, content - prefs.sqlite for permissions and preferences of Site
    • cert8.DB stored intermediate certificates
    • sessionstore.js to open and pinned tabs and tab groups

Maybe you are looking for