Passion of IT

JPA, REST and SOAP

Yesterday I added to my Java project (temporany name: “AffittaVetrina”) three important technologies:

JPA (Java persistence API)  is a specific ORM (object relational mapping) for JAVA

JPAthis technology is used for mapping the table of DB in java classes that are also serializable, for these reasons jpa is used with web services.

The major problem of JPA is that it is difficult to make complex queries with it because it is not possible to write jpa queries with math operators like sum or power etc.

Solving this disadvantage is easy by using  CriteriaQuery class that maps java queries in a tree and allows the developer to made all kind of queries.

The query written with CriteriaQuery is not a string but it is a java class and it is a little bit more difficult making or editing it than classic SQL.

WebService

WEB SERVICE: is special technology to interconnect different heterogeneous systems that uses different programming languages, different ISO OSI protocols etc.

The comunication among these systems is possible because there is the IDL (interface definition language): a file written in IDL is the identity card of the service, it shows the ways to comunicate with this service, the socket (IP,PORT), the name of the methode, the params (types, values) etc.

When you have a IDL file you can make the client of this web services.

The IDL file is public because contains only the interfaces of the server, the implementation is hidden

The first type of web service that I have made is SOAP

in this web service client and server comunicates through XML files (SOAP protocol: Simple Object Application Protocol) and the IDL is a WSDL file (Web Service Description Language).

If you have WSDL file of my web service written in java, you can develop the client in Visual studio .net for example.

UDDI is a file used for knowing the other users that this web service exists and it is available on a specific socket (ip, port)

 

Specifically my web service has two optional parameters: address and category.

The same service is made of RESTful service technology.

The comunication of REST is possible by using HTTP (HyperText Transfer Protocol) not SOAP.

With REST you can use the HTTP protocol to make possible the comunication between your client application and a REST service.

You can use all the four HTTP commands  (GET,PUT,POST,DELETE) to make a different operation to your service, specifically:

  • GET: to obtain specifical information (select SQL query)
  • POST: to update information of the DB
  • PUT: to insert information on DB
  • DELETE: to delete information on DB

In my web service I developed only the GET method because I want that the people can only see the shops stored on my system,.

The IDL of REST services is the structure of the link of the application.

The operation to convert objects written in java to a structure of data that is easy to send to the destination endpoint is called “Serialization“.

The serialization operation is automatic when you use web services because the only way to send the information is via XML (SOAP is XML)

When you use REST services you can choose between the XML marshaller or it is possible to use a small and efficient technology that require less data to exchange between client and server, this technology is called JSON (Java script object notation).

I used JSON for my REST service with the java library REST EASY

 

No Comments Yet

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite="
"> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Recent Comments

Michele Rizzithe website doesn't exist. Ara you a robot? In any case it's difficult that an automatic system writes a comment here since there are two captchas...
Hello there! This is kind of off topic but I need some guidance from an established blog. Is it very hard to set up your own blog? I'm not very t...
We are a group of volunteers and opening a new scheme in our community. Your web site offered us with valuable information to work on. You've done a...
December 2024
M T W T F S S
« Dec    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Login