+ Reply to Thread
Results 1 to 9 of 9

Thread: SoapHeader fatal error

  1. #1

    SoapHeader fatal error

    Hi I added some for
    <?php
    // SOAP_CLIENT_BASEDIR - folder that contains the PHP Toolkit and your WSDL
    // $USERNAME - variable that contains your Salesforce.com username (must be in the form of an email)
    // $PASSWORD - variable that contains your Salesforce.ocm password

    define("SOAP_CLIENT_BASEDIR", getcwd()."/soapclient");
    require_once (SOAP_CLIENT_BASEDIR.'/SforceBaseClient.php');
    require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php');

    try {
    $mySforceConnection = new SforceBaseClient();
    $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
    $USERNAME = "seetharam@securenext.net";
    $PASSWORD = "india4321pFKOj0NnYN12360kP9R5duZoQZng";
    $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);

    if($mylogin){
    print "Sucessfully login";
    }
    else{
    print "Invalid login";
    }

    $sObject = new stdclass();
    $sObject->FirstName = 'Smith';
    $sObject->LastName = 'John';
    $sObject->Phone = '510-555-5555';
    $sObject->BirthDate = '1927-01-25';
    $sObject2->customfield__c = 'ABC Company';


    $sObject2 = new stdclass();
    $sObject2->FirstName = 'Mary';
    $sObject2->LastName = 'Smith';
    $sObject2->Phone = '510-486-9969';
    $sObject2->BirthDate = '1957-01-25';
    $sObject2->customfield__c = 'XYZ Company';
    exit();
    echo "**** Creating the following:\r\n";
    $createResponse = $mySforceConnection->create(array($sObject, $sObject2), 'Contact');

    $ids = array();
    foreach ($createResponse as $createResult) {
    print_r($createResult);
    array_push($ids, $createResult->id);
    }
    echo "**** Now for Delete:\r\n";
    $deleteResult = $mySforceConnection->delete($ids);
    print_r($deleteResult);

    echo "**** Now for UnDelete:\r\n";
    $deleteResult = $mySforceConnection->undelete($ids);
    print_r($deleteResult);

    } catch (Exception $e) {
    echo $mySforceConnection->getLastRequest();
    echo $e->faultstring;
    }
    ?>

    getting Error Like
    Fatal error: SoapHeader::SoapHeader() [<a href='soapheader.soapheader'>soapheader.soapheader </a>]: Invalid parameters. Invalid namespace. in /home/webuser/html/KT_Dodge/soapclient/SforceBaseClient.php on line 150

    can you you any one Help it was an Urgent one

  2. #2
    Join Date
    May 2007
    Posts
    506
    Blog Entries
    3
    Listen I am just going to attempt this because I am going out of town this morning. I use the oartner wsdl, but you could try to comment out the

    wait aren't you missing something?

    PHP Code:
    define("SOAP_CLIENT_BASEDIR""../../soapclient");
    require_once (
    SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
    //require_once (SOAP_CLIENT_BASEDIR.'/SforceHeaderOptions.php'); 

    try that

  3. #3
    Join Date
    May 2007
    Posts
    506
    Blog Entries
    3
    You are missing that line above in the post, the sforceenterpriseclient.php

  4. #4

    again getting another issue

    when i try to post the data getting error like
    210600D900000000Rgd!ARcAQPFP45cG6k_13peksIm6XWQYSR zhiSAt325eS85yF50BvQySbTdyUgKGVN9paB.YKSqgD1uODUAL 0AP2yitUKK2UqArA INVALID_TYPE: Must send a concrete entity type.

  5. #5
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header>
    <ns1:SessionHeader>
    <ns1:sessionId>210600D900000000Rgd!ARcAQPFP45cG6k_ 13peksIm6XWQYSRzhiSAt325eS85yF50BvQySbTdyUgKGVN9pa B.YKSqgD1uODUAL0AP2yitUKK2UqArA</ns1:sessionId>
    </ns1:SessionHeader>
    <ns1:AssignmentRuleHeader>
    <ns1:assignmentRuleId xsi:nil="true"/>
    <ns1:useDefaultRule xsi:nil="true"/>
    </ns1:AssignmentRuleHeader>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
    <ns1:create>
    <ns1:sObjects>
    <ns1:sObjects/>
    </ns1:create>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

  6. #6
    Join Date
    May 2007
    Posts
    506
    Blog Entries
    3
    I do not work with the enterprise wsdl man, there are examples over at the phptoolkit download (from my main menu). I use the partner wsdl to do all my work, it is a lot more flexible, you should try that one. I have plenty of examples here that work with that

    ~Mike

    PS: If I had more time right now, I would, but I am going to be out of the area without a PC and cannot do any examples because I will not have my laptop with me, sorry sir!!

  7. #7
    Hi Mike

    Can you provide some examples or code on How i can post the Mysql data to Salesforece using Create,Update and upsert

    Thanks can helpfull for me now

    if you can Please

  8. #8
    Quote Originally Posted by Baburaj View Post
    Hi Mike

    Can you provide some examples or code on How i can post the Mysql data to Salesforece using Create,Update and upsert

    Thanks can helpfull for me now

    if you can Please

    public function create($sObjects, $assignment_header = NULL, $mru_header = NULL) {

    $arg = new stdClass;
    foreach ($sObjects as $sObject) {
    $sObject->any = $this->_convertToAny($sObject);
    }
    $arg->sObjects = $sObjects;
    if ($assignment_header != NULL) {
    $this->_setAssignmentRuleHeader($assignment_header);
    }

    if ($mru_header != NULL) {
    $this->_setMruHeader($mru_header);
    }
    if ($assignment_header == NULL & $mru_header == NULL) {
    $this->_setSessionHeader();
    }

    return $this->sforce->create($arg)->result;
    }

  9. #9
    Join Date
    May 2007
    Posts
    506
    Blog Entries
    3
    You want some examples of pushing data from MySQL to Salesforce for create, update, etc..

    There are some here on the site already if you search. Just look around, but if you have something that you need specific help with, I will be more than happy to try and give you a hand

    ~Mike

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.0 RC1 PL1