niedziela, 28 października 2012

accessing the WS-client code from SVN repository

In this post I will describe in a few lines what could happen during and after the Android WS client checkout from the SVN repo. So the first steps are similar like in the previous post when we was downloading our local version of the webservice project (WS producer).

After checkout we should do Clean on our new project. So choose Project in the main menu and click the Clean option.




Choose the AndroidWSClient project from the radio options select and approve the clean and rebuild operations.



The error should appear in the Problems and also in Console  views:


Android requires compiler compliance level 5.0 or 6.0. Found '1.7' instead. Please use Android Tools > Fix Project Properties.


Let do the steps described in error information. Go to Project Explorer and choose the AndroidWSClient project name. Click right mouse button. From the context menu choose the Fix Project Properties options and perform another clean operation on our project. 




After that notice that Error is missing in the Problems view.




accessing the WS-producer code from SVN repository


Checkout project code

  1. Create new workspace area (if you want you can add/import project to existing workspace);
  2. Go to menu File->Import->SVN->Project from SVN and click Next;
  3. On next window ("Enter Repository Location Information") write svn repo URL path: https://subversion.assembla.com/svn/pg_projekty/ and click Browse;
  4. Choose "webservice" project from list and click OK button;

     5. Under Authentication credential write: "slav3" both for user and password and click Next;
     6. Choose the head revision and click "Finish" button and on another window also "Finish";
     7. The "webservice" project should be imported like this one below: 









  • 8. If we take a look on the "Markers" view (or "Problems" view imported from General group of views), we should see some errors. This is the result of the wrong settings of the Java Build Path. On another steps we will investigate that.

Handling with Java build path dependencies

OK. What eclipse is trying to tell us?




  • "Target runtime GlassFish 3.1.2 is not defined", Type: Faceted Project Problem.
    This error is directly connected with lack of the application server instances. We must create it on our own. So go into Servers views (tab in the same bar location as the Problems view). You can see the No servers available information. Click on the new server wizard link:

          On the window choose the "GlassFish 3.1.2" server and accept it by clicking the "Next" button:


On the next screen you must select the JRE/JSD Runtime. I assume that you have installed the JDK library. For GlassFish to run, we must select proper JDK environment from our drive. If you don't have the JDK on the drop-down list next to "JRE:", please click on the "Installed JRE preferences" and proceed to next window.


Click the "Add" button to add the JDK environment installed on your local drive and select "Standard VM" JRE type. Proceed to next window - click "Next" button. Select the path to your local installation of  the JDK by pressing the "Directory" button - in the right side of the "JRE home" label row. After selecting the proper JDK, list of packages should appear in the libraries window list:




click on "Finish" button. Make sure to check the proper (just added) JDK environment and click "OK":


Choose the just added jdk environment from the JRE drop-down list and choose the main folder of the GlassFish server installed on your local machine and clik Next:


On the next window write credential for server (note to remember it - will be needed during the development process). and click Finish button. The GlassFish server is ready to use and could be launched. Select the created server and push the Ctrl+Alt+R buttons combination. After a few seconds GlassFish should be ready to use (remember to put the credential when server will ask you during starting process).

Add webservice project into GlassFish server. Click the right mouse button on the webservice project in the Project Explorer window and choose the Run as option from the appearing menu and next Run on server option. Choose the GlassFish server and click Finish button.




After that the webservice producer project should be launched on server. The HTTP Status 404 browser window will appear - don't bother with it (just close it) - it is the Web-Service application. There is no presentation window. 

So. That is all for the webservice producer code project. 



creating the web-service application

First of all we will create normal new Dynamic Web Project in File option of main eclipse menu.

Project kick-off

The aim of the project is to learn net technologies used on mobile platforms. In this specific case we will be hanging around the Android mobile platform. On this system we will create web client application which will let us to show map of some city (previously chosen one) transferred by HTTP protocol, direct from the web-service port. The mentioned service will be also created by us. It will be the heart of whole application.

OK. The city chosen previously is Grudziądz from Poland. Map will be the cut of the Open Street Maps project, saved into image format (jpg, png) in scale 1:10000 and maximum resolution 1000x1000 pixels.

When the Android application client will be launched it will request to web-service to have back whole map.
This is the first part of the application. Later we will do some more complicated functionality.

We will build application in Eclipse IDE. Web-service will be deployed on Glassfish server. To connect with web-service on Android client we will use KSOAP2 library,which is free to use.

So let's start!