I am using webservices for connecting the android app with server side using ksoap2 library. The problem is that despite of reading various related stuff, I am still confused about the terms marshaling, searlizing, desearlizing etc.
What is actually the difference between them? and why we need to do it. I just know that it is related to webserivces only and it is basically done for passing or returning values from webservices. Why we actually need them and how we actually searlize or desearlize the stuff or webserver itself gives us this functionality??? We need to write code for marshaling or searlization at client side or in webservice itself? Is there anyway that we don’t have to do this and call a webservice in such a way that no need to searlize or desearlize the stuff or alternatively any library that we can include in the project to do it automatically? Please guide
I am using webservices for connecting the android app with server side using ksoap2
Share
marshaling/serializing, unmarshalling/deserializing are often used interchangeably in the webservices world and basically they mean the same.
When sending a request to a web service you need to build it in a certain way, if its a REST web service, the format of the request/response is usually in XML or JSON.
If it is a SOAP web service the format would be XML.
So every time you send a request you need to build it in the correct format and this is called marshalling/serializing.
Every time you get a response you need to parse it and that is called unmarshalling/deserializing.
I suggest you learn REST web services as they are easier and more flexible.
EDIT:
In order to connect to a REST service in java you should use HttpURLConnection.
here is a sample code of how it might look: