1

As I can see there is a get_contact() function in CRM/Utils/SoapServer.php. I would like to use this function to get the list of contact. How can I do that ? Is it similar to how we make a Rest api call like http://<site_name>/sites/all/modules/civicrm/extern/soap.php? ? If it is, what params do I need to pass to get the required result ?

Any help/hints would be appreciated. Thanks.

Update : I'm using the latest version of CiviCRM.

1 Answer 1

2

I don't have a proper answer to the question of how to use SoapServer, but it may be useful to place that in context.

The extern/soap.php script is a bit of a relic which is not on par with the RESTy APIv3. I was just a casual user at the time, but I'm pretty sure it predates APIv3 and (probably) APIv2. Its major use-case was facilitating a fast return-channel for CiviMail. (There's some kind of smtpd/perl/soap integration which folks used to use.) IMHO, the only reason to retain it in the codebase is for backward compatibility (on the off-chance that it maybe still works for existing installations).

If you skim the code of CRM_Utils_SoapServer, you'll see get_contact() and a bunch of mail-related actions (and basically nothing else). The design is generally... shallow.

If you really do need SOAP access, then I'd recommend implementing new bindings between SOAP and APIv3. Ideally:

  • The SOAP implementation should be generic, passing along requests to civicrm_api3() and getting metadata from civicrm_api3 (ie Entity.get and *.getfields).
  • The SOAP end-point should ideally go through the menu/router system -- rather than a standalone script (e.g. http://example.com/civicrm/soap instead of http://example.com/sites/something/modules/civicrm/extern/soap.php).
  • The SOAP end-point should ideally go into an extension.
1
  • Thanks for the detailed description. Now, I get a proper idea of my findings related to this:) Commented Aug 11, 2015 at 13:20

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.