Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is better? High number of web service calls (SOAP messages) or high amount of data in single Soap Message?


I am designing a mobile application which gets server data through SOAP messages.

I wanted to know what is the best practice:

  • More number of web service calls fetching less data in each SOAP message call.
    OR
  • I get all data in a single web service call but then the length of SOAP message would be large.

    Wouldn't the high amount of data in a single soap message create data connectivity issues for mobile subscriber.

    In my application for a particular year I have to get names of all car manufacturers and model names for all cars by each manufacturer. I have two plans:
  • As the user selects a year I send a web service which will get all the data.
  • As the user selects a year I get the names of manufacturers and then when user selects a manufacturer i get all the models for that manufacturer.
    please help by telling me which approach should I take.

*PS:*user can have many vehicles and if I use second approach then web services will be called for every vehicle.

like image 891
Aneesh Garg Avatar asked Nov 29 '11 10:11

Aneesh Garg


People also ask

What is the purpose of SOAP in a web service?

SOAP is a messaging protocol for exchanging information between two computers based on XML over the internet. SOAP messages are purely written in XML which is why they are platform and language independent. A SOAP message contains: An Envelope that indicates the start and end of the message.

Does SOAP use HTTP?

SOAP can be carried over a variety of protocols, enabling communication between applications with different programming languages on both Windows and Linux. Works on the HTTP protocol. Even though SOAP works with many different protocols, HTTP is the default protocol used by web applications.

What is SOAP architecture?

SOAP is a protocol for the exchange of information in a distributed environment. SOAP messages are encoded as XML documents and can be exchanged using various underlying protocols.


2 Answers

Couple of points

  1. As pointed out in the comment Use JSON instead of SOAP where ever possible, SOAP is very heavy weight and is not being recommended these days.( look at all the endpoints being exposed by Google and others - most of them use JSON )

  2. If the xml size is becoming too large ( beyond few kilobytes) it is better to make multiple calls rather than loading a large object in memory.

like image 161
Rajdeep Dua Avatar answered Oct 23 '22 04:10

Rajdeep Dua


On a mobile connection, I'd opt for larger responses because of the network latency. It's better to fetch a bunch of things in one go than to fetch each item in a new roundtrip. This will keep your app fast.

Even larger responses can be efficiently handled without needing to store those in memory if you use a library that can "stream" the response.

like image 39
botteaap Avatar answered Oct 23 '22 05:10

botteaap