Web services with PHP

Hi

I've read what available information there is for integrating Web Services using PHP but am having problem getting started. I'm not using nuSoap but the standard Soap features of PHP7.

I can successfully connect, log on and acquire __getFuntions() and __getTypes() data. Can someone please supply an example of how to use the query() function:

$client->query('personid = 123','person') and $client->query(array('queryString'=>'personid = 123','entityname'=>'person')) both seem to fail.

Thanks

  • 0

    Martin

    I've been looking for some documentation for the use of PHP and Sage CRM web services but I have not had any luck so far.

    I am sure that you have found the general documentation. help.sagecrm.com/.../WS_FAQs.htm

    If you are able to connect and create a session then you may want to look at the web services logs that Sage CRM creates. This will contain the exact XML that is passed. This should give you a good clue to the way in which the PHP code is building the request.

  • 0

    Martin

    Do you have admin rights on your instance of Sage CRM? If you do then the Admin > Customization area is the best place to look. This will provide the exact field names.

    The WSDL is another place to look but this will actually show fields with their XXXX_ prefixes removed.

    http://[servername]/[instancename]/eware.dll/webservice/webservices.wsdl

    e.g.

    localhost/.../webservices.wsdl

  • 0

    Ah...the prefix are dropped in the naming of the XML elements. BUT if you are passing a string to SQL then you need to name the fields as SQL expects them.

  • 0

    Thanks. I agree, PHP docs do seem to be pretty generalised and sparse.

    I do seem to be getting somewhere with calling the function with parameters inside an array (2nd example above) but I get:

    "SOAP-ENV:Server-Query failed to run successfully."

    I guess that means it tried but my query stanza is wrong. Where's the best place to find the actual SQL field names I should be using?

  • 0

    Ah, prefixes. I'm sure I read here somewhere that prefaces were not required but it seems that, in fact, they are. First hurdle cleared. Thanks

    Works: $client->query(array('queryString'=>'pers_personid = 123','entityname'=>'person'))