function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VHanson1VHanson1 

How do I call webservice via SOAP PHP with Parameters?

I have a webservice setup in my salesforce instance that is called CheckUserPermissions(String param1, String param2).  I am able to use the PHP code below to successfully login and execute the command.  HOWEVER, I am only able to pass the first parameter to the method -- the second parameter doesn't seem to come through.

 

I've verified that the param1 value comes through successfully, but param2 is always NULL.

 

PHP CODE:

  $sessionID = $mySforceConnection->getSessionId();
 
                $value1 = 'value1';
                $value2 = "value2";
 
 
 
                $wsdl="soapclient/ContractMgtUtils.wsdl.xml";
                $NAMESPACE = "http://soap.sforce.com/schemas/class/ContractMgtUtils";
 
    $sforce_header = new SoapHeader($NAMESPACE, "SessionHeader",
                        array("sessionId" => $sessionID, "param1" => $value1, "param2" => $value2));
    $client = new soapclient($wsdl);
    $client->__setSoapHeaders(array($sforce_header));
 
  //           $client->
                
 
    try {
                   $response =  $client->CheckUserPermissions();
                  
                echo $response->result;
//        print_r($response);   
    }
    catch(Exception $e) {
        print "<pre>";
        print_r($e);
        exit;
    }

 

Lalit Sharma CybageLalit Sharma Cybage
The reason for unable to send the second parameter is due to  double quote.    
                Correct them to  $value2 = 'value2';