Monday 3 August 2015

REST vs SOAP


SOAP stands for Simple Object Access Protocol. REST stands for REpresentational State Transfer.

SOAP is a XML based messaging protocol and REST is not a protocol but an architectural style.

SOAP has a standard specification but there is none for REST.

Whole of the web works based on REST style architecture. Consider a shared resource repository and consumers access the resources.

Even SOAP based web services can be implemented in RESTful style. REST is a concept that does not tie with any protocols.

SOAP is distributed computing style and REST is web style (web is also a distributed computing model).

REST messages should be self-contained and should help consumer in controlling the interaction between provider and consumer(example, links in message to decide the next course of action). But SOAP doesn’t has any such requirements.

REST does not enforces message format as XML or JSON or etc. But SOAP is XML based message protocol.

REST follows stateless model. SOAP has specifications for stateful implementation as well.

SOAP is strongly typed, has strict specification for every part of implementation. But REST gives the concept and less restrictive about the implementation.

Therefore REST based implementation is simple compared to SOAP and consumer understanding.

SOAP uses interfaces and named operations to expose business logic. REST uses (generally) URI and methods like (GET, PUT, POST, DELETE) to expose resources.

SOAP has a set of standard specifications. WS-Security is the specification for security in the implementation. It is a detailed standard providing rules for security in application implementation. Like this we have separate specifications for messaging, transactions, etc. Unlike SOAP, REST does not has dedicated concepts for each of these. REST predominantly relies on HTTPS.

Above all both SOAP and REST depends on design and implementation of the application.

Pass ArrayList From OneActivity to AnotherActivity

    public class DataWrapper implements Serializable 
     {
       private ArrayList<String> arrayList;
       public DataWrapper(ArrayList<String> data) 
        {
         this.arrayList = data;
        }
       public ArrayList<String> getArrayList() 
       {
        return this.arrayList;
       }
      }
 

    Intent intent = new Intent(SubCat1Activity.this,Full1Activity.class);
    intent.putExtra("data",new DataWrapper(MainData));
    startActivity(intent);

    DataWrapper dw = (DataWrapper) getIntent().getSerializableExtra("data");
    ArrayList<String> list = dw.getArrayList();