Day 4: data storage

  1. justme2013

    justme2013 Member


    Today is my 4th day of learning adroid app dev, so, probably I'm very ignorant of what I'm going to discuss.
    Reading android dev guide, App Components | Android Developers

    But I'm puzzled by the Data Storage part, that is, I did not find any where it mentioned that an android app would be able to write and retrieve data from a centralized db server vs jdbc or whatever, if this is true, how would an android app for an enterprise work in terms of corporate data?

    Please shed some light here.


  2. jonbonazza

    jonbonazza Well-Known Member

    You would write and host a number of web services on a remote server, then use any of the remote connecton interfaces available to Android/Java to connect to the service. On completion, the service should send a response back to the client containing any data you requested, along with a status code.
  3. justme2013

    justme2013 Member

    " use any of the remote connecton interfaces available to Android/Java", ok, so, one would need to look at the Connection section of the guide for enterprise data connection, correct? Thanks for your knowledgeable answer.
  4. cryofy

    cryofy Member

    You won't find any information in the 'connection section' of how to implement your web service. Only thing that you'll be told is to use the*,* packages...

    It's totally up to you of how to design your web service (if you implement a new one) or up to the enterprise service you'd like to interact with. You or the enterprise could use JSON, some REST Api, SOAP, etc...
  5. justme2013

    justme2013 Member

    ok, let's say, this enterprise has a web service to allow other system to consume its service, and say, it's 111.222.333.444/webservice?wsl&action=dataRetrieval&dtTBL=contacts

    Which would retrieve all the contact info of the given data source.
    Now, how would we code from the android end to consume such service? Where can I dig some sample code?

  6. jonbonazza

    jonbonazza Well-Known Member

    You won't find much sample code because it's entirely dependent on how hte web service is setup. does it return JSON? plain text? what? First, look into connectin a remote hose and receiving a response. after you have that working, look into parsing the response, depending on how it is formatted.
  7. justme2013

    justme2013 Member

    All right. I've done some research, using kSOAP2 to consume web service is a way to go with android. And i've downloaded two libraries, namely, ksoap2-android-assembly-3.0.0-RC.4-jar-with-dependencies.jar and added it to java path for the project, still got
    import org.ksoap2.transport.AndroidHttpTransport UNRESOLVED error
    then, downloaded the full library, ksoap2-j2se-full-2.1.2.jar
    and added it to the project java path, still same error.

    How come while importing other ksoap2 classes such as org.ksoap2.SoapEnvelope has no prob? Or am I doing something wrong?

  8. cryofy

    cryofy Member

    Did you put those jars in the libs folder of you project, e.g.: "myProjectName\libs" ?
  9. justme2013

    justme2013 Member

    Previously no, I just used ADT's function to add external library to the project, but just now I did, F5 did not seem to refresh or fix the prob, so, I close ADT and re-open it, still same error. Could it have something to do with my following code?

    private final String NAMESPACE = "";
    private final String URL = "";
    private final String SOAP_ACTION = "";
    private final String METHOD_NAME = "getOnePart";

    Btw, is NAMESPACE sort of like BASEURL? Not exactly sure it works with ksoap2. Also, the URL has been tested to return a simple value.


Share This Page