25

Why is it not a good idea to use SOAP for communicating with the front end? For example, a web browser using JavaScript.

4 Answers 4

42
  • Because it's bloated
  • Because JSON is natively understandable by the JavaScript
  • Because XML isn't fast to manipulate with JavaScript.
3
  • 1
    Agreed on all three points. XML is bloated and a challenge to handle with js while JSON is concise and native.
    – Prestaul
    Sep 24, 2008 at 15:32
  • Hmmm...found this on a search for how to allow my users to input through their browsers where the only access is via SOAP interface. I am out of my deptyh here - any comments?
    – cvsdave
    Mar 1, 2011 at 12:57
  • Well, you can try to use any of the JS implementation of the SOAP protocol, like codeproject.com/KB/ajax/JavaScriptSOAPClient.aspx and build a UI around that in HTML to grab the input from the user. Good luck.
    – gizmo
    Mar 1, 2011 at 13:26
18

Because SOAP reinvents a lot of the HTTP wheel in its quest for protocol-independence. What's the point if you know you're going to serve the response over HTTP anyway (since your client is a web browser)?

UPDATE: I second gizmo's (implied) suggestion of JSON.

5

If the web browser is your only client then I would have to agree that SOAP is overkill.

However, if you are going to have multiple types of front end clients on running on different platforms then SOAP may be appropriate. The nice part about SOAP is that there are a lot of tools out there that will generate code for you to handle sending, receiving, and parsing of SOAP based on the WSDL file.

For example, if you wanted to develop a C++ front end client then all you need is the WSDL file and Microsoft's tools will generate all the C++ code to generate the SOAP request based on a data structure, send the request, receive the response, and parse the response into a return data structure.

There are tools to do this both on the client and server side.

1
  • I agree that if you need to exchange data between platforms that SOAP is a reasonable method. However, if you have data available through a SOAP web service that you want to access with js then it is worth the effort to send the data to the page with JSON. Don't parse it on the client.
    – Prestaul
    Sep 24, 2008 at 15:39
3

It could be done. Just remember that SOAP is not the fastest way to exchange information as there is a big overhead (big XMLs have to be sent back and forth) - that's probably why you don't see it used that often

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.