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
Brad_Baker_62Brad_Baker_62 

can't get HelloWorld app running

When running the app as below with my SalesForce name and password and I get
"Could not connect to host".  Anyone know what could be causing this?  I do have admin priviledges on my salesforce account.


require_once ('../soapclient/SforcePartnerClient.php5');

try {
  $mySforceConnection = new SforcePartnerClient();
  $mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml");
  $mylogin = $mySforceConnection->login("name@vocera.com", "password");
 
  $userResult = $mylogin->userInfo;
  echo $userResult->userFullName.', '.$userResult->userEmail.', your session id is '.$mylogin->sessionId;
} catch (Exception $e) {
  echo $e->faultstring;
}
Erik PetersonErik Peterson
I don't typically deal with PHP, but I think you need to download your organization-specific WSDL, and then change the

Code:
$mySoapClient = $mySforceConnection->createConnection("partner.wsdl.xml");

 
line to point to that WSDL.
Brad_Baker_62Brad_Baker_62
I tried both the Partner and Enterprise WSDL files I downloaded from AppExchange API section of Saleforce.com.  Neither worked with my SalesForce.com login/password or another SForce developer account I opened (with different email address).

I opened a Support ticket with SalesForce.  I'll see where that goes, but if anyone else has any ideas, I'm all ears.

thx, -Brad-
Tran ManTran Man
Did you enable SSL in your PHP setup?
Tran ManTran Man
The PHP toolkit can only be used with the Partner WSDL.
Brad_Baker_62Brad_Baker_62
Running phpinfo() shows I'm running PHP5.1.4 with SSL enabled...

OpenSSL Version OpenSSL 0.9.7a Feb 19 2003
sean_at_33050sean_at_33050
Thought I'd contribute:
I had an issue getting the HelloWorld demo to work (not the command line one but the login.php one)
 
Problem was the form in login.php demo had MAXLENGTH for the user input box set at "30" so my full username did not fit.
I changed it so my full user name did fit.
Code:
  <tr><td><strong>User Name:</strong></td><td><input type="text" name="user" maxlength="40"></td></tr>

 
Also, I did not get any errors displayed so I changed the single quotes here to double quotes and it worked:
Code:
change this:
  echo '<p><span style=\"color:#FF0000\">$errors</span></p>';

to this:
  echo "<p><span style=\"color:#FF0000\">$errors</span></p>";

 

 
Tran ManTran Man
Thanks, I'll correct this in the next version of the toolkit.
Brad_Baker_62Brad_Baker_62
I've opened Case 00930418 with SalesForce Support on this.  We'll see where it leads.
Brad_Baker_62Brad_Baker_62
It's working now.  One problem was my web host (Godaddy) must have something blocking connections out to SalesForce. Perhaps some port. I installed XAMPP (version 1.5.3a) on my laptop and it works now.  Another problem I hit was that Apache/2.2.2 (Win32) would not start (via command line) with Skype loaded.  Closing Skype, it started fine. Strange though, to double check, I started Skype again, stopped Apache, then started Apache again and it worked.  So not sure what was going on there.

I would recommend installing XAMPP for developers, it's really very easy to get everything installed and up and running.  SOAP, SSL, and other things needed by SForce are already enabled.

One thing.   I was getting the following warning when running the sample\Welcome.php ...
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\xampp\htdocs\salesforce\samples\header.inc:9) in D:\xampp\htdocs\salesforce\samples\welcome.php on line 32

Commenting out the header.inc lines in the samples allowed it to run.
MattCamMattCam

>
>One thing.   I was getting the following warning when running the sample\Welcome.php ...
>Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\xampp\htdocs\salesforce\samples\header.inc:9) in >D:\xampp\htdocs\salesforce\samples\welcome.php on line 32
>
>Commenting out the header.inc lines in the samples allowed it to run.
>

This is just a configuration issue in the PHP.ini you need to set the output buffer to on or 4096. In XAMPP the Php.ini is in the apache/bin folder.
output_buffering = 4096