tags:

views:

78

answers:

2

I am using the nusoap lib with a cakephp app for legacy / compatibility reasons, I was just wondering if it was totally necessary to create an instance of nusoap_server, I can't figure out any obvious reason for doing this when i can just output any data formatted as xml nilly willy without creating a server instance - is it perhaps just for debugging purposes?

+1  A: 

(I've never used nuSOAP, but I'm guessing it's quite the same as PEAR::SOAP, the native SoapServer extension, and Zend_Soap)

Your server instance will :

  • parse the SOAP XML data that your application receives, and dispatch it to the right class/method
  • encapsulate the return of that method into SOAP XML

Considering how complex the SOAP format is, I would definitly not want to parse it by myself, nor would I want to re-construct some SOAP string -- especially if a library that can do that for me already exists !

Pascal MARTIN
+1  A: 

It depends on whether you are making SOAP calls or receiving SOAP calls.

To make them, you need to create the appropriate client instance to do the WDSL processing and assemble the XML.

To receive them, you need to create the server instance and tell it how to dispatch the various calls.

It is entirely reasonable for your app to only need to do one of those.

staticsan
im just trying to wrap my head around why do i need to use SOAP (or why my senior devs say I should), why not just output xml based on the url eg REST, SOAP seems to be overly complicated...
bananarepub
SOAP is a message/RPC abstraction protocol. It seems big and heavy because of that. If you're fitting into an environment that already uses SOAP, then you really have little choice. Then, too, implementing SOAP on some other platforms is quite straightforward and therefore tends to be the obvious choice. PHP, though, takes a bit more of a bits-n-pieces approach, which does make it a bit more complex.
staticsan