0 Replies Latest reply on Feb 27, 2013 8:29 AM by 993617

    How to use This webservice in PHP ?


      I'm trying to use this webservice in PHP but there isn't a documentation or something that can help me.

      I have this function, and she returns to me a sessionID :

      function wslogin() {
           global $crmdomain;
           $url = $crmdomain . "/Services/Integration?command=login";
           $page = "/Services/Integration?command=login";
           $headers = array(
           "GET ".$page." HTTP/1.0",
           "UserName: *****",
           "Password: *****",
           $ch = curl_init();
           curl_setopt($ch, CURLOPT_URL,$url);
           curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
           curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
           curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
           curl_setopt($ch, CURLOPT_HEADER, true);
           $data = curl_exec($ch);
           if (!curl_errno($ch)) {
                // Show me the result
                $sessionid = substr($data,(strpos($data,"Set-Cookie:")+23),(strpos($data,";")-strpos($data,"Set-Cookie:")-23));
                return $sessionid;

      Now, i want to retrieve for example an user... i need to get an user, set an user (insert or update), check if a user exist or not...

      I have test this :

      function getContactInfo ($contactid,$sessionid) {
           global $crmdomain;
           $serverpath = $crmdomain . "/Services/Integration;jsessionid=$sessionid";
           $namespace= "urn:crmondemand/ws/contact/10/2004";
           $soapaction = "document/urn:crmondemand/ws/contact/10/2004:ContactQueryPage";
           $param = "<ListOfContact>

           $method = "ContactWS_ContactQueryPage_Input";

           $response = getwsresponse($serverpath,$namespace,$soapaction,$method,$param,$debug);

           return $response;

      function getwsresponse($serverpath,$namespace,$soapaction,$method,$param,$headers=""){
           $client = new nusoap_client($serverpath, array('trace' => 1));
           if($headers != ""){
           $response = $client->call($method,$param,$namespace,$soapaction);
           return $response;

      But when i check : var_dump(getContactInfo("Integrationd",wslogin())); i have always false...

      I have no idea how to use this webservice. Can you help me ?

      Thanks !

      Edited by: 990614 on 27 févr. 2013 00:29