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
Mike @ PartnersMike @ Partners 

Partner WSDL help

I am trying to make calls to the API but keep getting this error about 75% of the time i run the code. here is the error:


Warning: SoapClient::__construct() [function.--construct]: I/O warning : failed to load external entity "partner.wsdl.xml" in ....../salesforce/soapclient/SforceBaseClient.php on line 57
There was a problem with your login: SOAP-ERROR: Parsing WSDL: Couldn't load from 'partner.wsdl.xml'

Any ideas on what this error is saying. The other strange thing is I took the exact code I used for other web app and put it into this app. The other app works fine, no problems ever. The only thing different between the two web apps is there location under the root folder. I made the correct adjustments to the files so they point to where they need to, but I still get this error. It seems as if it can't find the wsdl file on my server. The strange thing about that is the page before this error is my log-in page, I don't get any errors on that page then the moment I get to this page I get this error.

Any ideas would be helpful.
Thank you,
Mike

Tran ManTran Man
This sounds like an environmental issue.  Are you loading the wsdl from the local filesystem?
Mike @ PartnersMike @ Partners

Well that was my thought as well. But I think it is a session problem. I have this page set up like this:

I have the main page that has one frame on it, that frame contains my log-in page. So what I would like to see happen is to have them come to the main page, then click the button in the frame, then the frame goes through its thing and then comes back with the info. And here is where I think the problem is. When it comes back with the info it also displays the button to run the action again. Every time I close the i.e. and re-open it and go to that page it works great. But any time after that I get the error. Could it be that I get the error because I am trying to create two sessions with the same page?

I don't know, it is just a thought.
Any ideas would be great,

Thank you
Mike

ClaiborneClaiborne

A couple of thoughts

- You cannot store the salesforce.com client as a php session variable. You can store the the sessionId and session location as session variables. Then you can create a new salesforce.com client without having to send the login/password again.

- You may want to destroy the current session and restart if the user is logging in, but just use the sessionId and location if they exist.

Something like this

session_start()

if (isset($_SESSION['sessionId'] and isset['$_SESSION['location']) {

        // Establish client to sfdc
    $client = new SforcePartnerClient();
    $client->createConnection($wsdl);
   
    $client->sessionId = $_SESSION['sessionId'];
    $client->setSessionHeader($client->sessionId);
    $client->setEndpoint($_SESSION['location']);

}

else {

  

    use the login function

}

ClaiborneClaiborne

A couple of thoughts

- You cannot store the salesforce.com client as a php session variable. You can store the the sessionId and session location as session variables. Then you can create a new salesforce.com client without having to send the login/password again.

- You may want to destroy the current session and restart if the user is logging in, but just use the sessionId and location if they exist.

Something like this

session_start()

if (isset($_SESSION['sessionId'] and isset['$_SESSION['location']) {

        // Establish client to sfdc
    $client = new SforcePartnerClient();
    $client->createConnection($wsdl);
   
    $client->sessionId = $_SESSION['sessionId'];
    $client->setSessionHeader($client->sessionId);
    $client->setEndpoint($_SESSION['location']);

}

else {

 

    use the login function

}

ClaiborneClaiborne

Forgot to add, before you log in, destroy the current session and start a new one.

session_destroy();

session_start();

now login

Then reset $_SESSION['sessionId'] and $_SESSION['location']