 |
| This is a discussion on Salesforce Code Example #1 within the Salesforce PHP Tutorials forums, part of the Salesforce category; excuse me
where can i found SoapClient class ??
because i dont |

08-02-2007, 02:14 AM
|
|
Junior Member
|
|
Join Date: Aug 2007
Posts: 10
|
|
excuse me
where can i found SoapClient class ??
because i dont found it at sforcebaseclient.php, but when i compile error mesagge appear that that compiler not found soapclient class
the mesagge appear like this
"Fatal error: Class 'SoapClient' not found in C:\Documents and Settings\Johan\My Documents\Visual Studio Projects\PHP Project4\includes\soapclient\SforceBaseClient.php on line 91"
or in this line :
$this->sforce = new SoapClient($wsdl,$soapClientArray);
just information, i had download toolkits "php5-1.0.6". and i put it in the same location with you sample
C:\Documents and Settings\Johan\My Documents\Visual Studio Projects\PHP Project4\sforce.php
and the toolkits i put in
C:\Documents and Settings\Johan\My Documents\Visual Studio Projects\PHP Project4\includes\soapclient\sforcebaseclient.php
C:\Documents and Settings\Johan\My Documents\Visual Studio Projects\PHP Project4\includes\soapclient\sforceheaderoption.ph p
C:\Documents and Settings\Johan\My Documents\Visual Studio Projects\PHP Project4\includes\soapclient\sforcepartnerclient.p hp
C:\Documents and Settings\Johan\My Documents\Visual Studio Projects\PHP Project4\includes\soapclient\partner.wsdl.xml
thanks,
randy
Last edited by sarma; 08-02-2007 at 05:00 AM.
Reason: an error appear
|

08-02-2007, 08:30 AM
|
|
Administrator
|
|
Join Date: May 2007
Posts: 273
|
|
Randy
try changing the line:
PHP Code:
$this->sforce = new SoapClient($wsdl,$soapClientArray);
To this line. I think your problem lies that the toolkit does not have a SoapClient class, it does have the SforcePartnerClient though:
PHP Code:
$this->sforce = new SforcePartnerClient($wsdl,$soapClientArray);
<code dir="ltr" style="text-align: left; width: 510px;"><code></code></code>
|

08-02-2007, 09:06 PM
|
|
Junior Member
|
|
Join Date: Aug 2007
Posts: 10
|
|
@mike
i had try to change that line, but still get a problem like this
"Fatal error: Call to undefined method SforcePartnerClient::__setSoapHeaders() in C:\Documents and Settings\Johan\My Documents\Visual Studio Projects\PHP Project4\includes\soapclient\SforceBaseClient.php on line 120"
can you help me again to resolve that problem ??
also i want to know, where is this file are ??
adodb.inc.php and whats its mean
$conn = ADONewConnection("oci8");
i think its a query to connect to database with name oci8, its true ??
can you give me all method or class that the files needed ??
so i can compile succesfully
thanks,
randy
Last edited by sarma; 08-03-2007 at 04:45 AM.
Reason: still error
|

08-03-2007, 10:38 AM
|
|
Administrator
|
|
Join Date: May 2007
Posts: 273
|
|
sarma
Can you email me your script so I can take a look at it?
The adodb.inc.php is a database abstraction layer class that can connect to many different databases. In this case the OCI8 is connecting to Oracle. You can read about it here:
ADOdb Database Abstraction Library for PHP (and Python) for MySQL, PostgreSQL, Microsoft SQL Server, Oracle, Firebird, Interbase, LDAP, Access, VFP, DB2 and many other databases
Also for the headers, look at some examples that Nick Tran has posted in the APEX wiki > Error
|

08-03-2007, 03:47 PM
|
|
Administrator
|
|
Join Date: May 2007
Posts: 273
|
|
Quote:
Originally Posted by sarma
@mike
i had try to change that line, but still get a problem like this
"Fatal error: Call to undefined method SforcePartnerClient::__setSoapHeaders() in C:\Documents and Settings\Johan\My Documents\Visual Studio Projects\PHP Project4\includes\soapclient\SforceBaseClient.php on line 120"
can you help me again to resolve that problem ??
also i want to know, where is this file are ??
adodb.inc.php and whats its mean
$conn = ADONewConnection("oci8");
i think its a query to connect to database with name oci8, its true ??
can you give me all method or class that the files needed ??
so i can compile succesfully
thanks,
randy
|
Randy
Listen RedSummit over at the Salesforce Forums knew the error and I did not even think about this as a possibility. You have to enable SOAP on your PHP 5 install. That is why you are getting these errors. I am sorry that I did not catch that but I thought that you already had that enabled.
Do that and then switch your code back to what you had and then try to connect to salesforce.com. Let me know if that works or if you have anymore questions on ADOdb and how to get your scripts to run using ADOdb
Again, sorry I did not catch that!
~Mike
|

08-06-2007, 05:25 AM
|
|
Junior Member
|
|
Join Date: Aug 2007
Posts: 10
|
|
@mike
its OK mike
that program no error anymore, but my IE didnot show anything, just a white page ?
for this syntaks :
$conn = ADONewConnection("oci8");
oci8 is for oracle, can you tell me for MS.SQL what must i use ??
thanks,
randy
|

08-06-2007, 08:13 AM
|
|
Administrator
|
|
Join Date: May 2007
Posts: 273
|
|
Go to Code Initialization, High Speed ADOdb, Hacking ADOdb, PHP5 Features, scroll down:
PHP Code:
DSN-less ODBC (Access, MSSQL and DB2 examples)
ODBC DSN's can be created in the ODBC control panel, or you can use a DSN-less connection. To use DSN-less connections with ODBC you need PHP 4.3 or later.
For Microsoft Access:
$db =& ADONewConnection('access'); $dsn = "Driver={Microsoft Access Driver (*.mdb)};Dbq=d:\\northwind.mdb;Uid=Admin;Pwd=;"; $db->Connect($dsn);
For Microsoft SQL Server:
$db =& ADONewConnection('odbc_mssql'); $dsn = "Driver={SQL Server};Server=localhost;Database=northwind;"; $db->Connect($dsn,'userid','password');
or if you prefer to use the mssql extension (which is limited to mssql 6.5 functionality):
$db =& ADONewConnection('mssql'); $db->Execute("localhost', 'userid', 'password', 'northwind');
For DB2:
$db =& ADONewConnection('db2'); $dsn = "driver={IBM db2 odbc DRIVER};Database=sample;hostname=localhost;port=50000;protocol=TCPIP;". "uid=root; pwd=secret"; $db->Connect($dsn);
|

08-06-2007, 12:45 PM
|
|
|
posting custom objects and document attachment to salesforce
|
|
Hi there
Firstly, sterling work on the forum!
My client needs to post directly from a (php-based) webform to their salesforce deployment.
1. Can i use the web service to create a number of objects in the same request (or even using mulitple requests)?
2. Can I create an instance of a custom object using the webservice call from my php script?
3. Can I post a document attachment to salesforce using the web service interface?
Thanks for this
Dermot
|

08-06-2007, 02:37 PM
|
|
Administrator
|
|
Join Date: May 2007
Posts: 273
|
|
Quote:
Originally Posted by dermot
Hi there
Firstly, sterling work on the forum!
My client needs to post directly from a (php-based) webform to their salesforce deployment.
1. Can i use the web service to create a number of objects in the same request (or even using mulitple requests)?
2. Can I create an instance of a custom object using the webservice call from my php script?
3. Can I post a document attachment to salesforce using the web service interface?
Thanks for this
Dermot
|
Dermot -
Thanks for the message!
Questions 1 & 2 > You can have a php form create values to add (example) a contact or new account. At this time you cannot create Objects in a table that I am aware of, but that is about to change. There is a new item coming in this upcoming release that will allow you to create objects. It is called the Meta API. It is actually avaliable for the next couple of days for DEVELOPER accounts to test out, but I have not had a chance to run tests against it as of yet
Question 3 > I do not know if you can add attachments to salesforce from a form, I would need to check on that one.
Here is an example of a form that can add contacts to salesforce:
PHP Code:
<?php
ini_set("soap.wsdl_cache_enabled", "0"); error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
require_once ('./includes/soapclient/SforcePartnerClient.php'); require_once ('./includes/soapclient/SforceHeaderOptions.php'); if (isset($_POST['submit'])) { $contacts = array(); $contacts['FirstName'] = trim($_POST['fname']); $contacts['LastName'] = trim($_POST['lname']); $contacts['Phone'] = trim($_POST['pnumber']); $contacts['Email'] = trim($_POST['email']);
//clean contacts to allow changing of characters to XML $contacts = array_map('htmlspecialchars', $contacts);
//try to add contact from form try { //salesforce login and wsdl $wsdl = './includes/soapclient/partner.wsdl.xml'; $userName = "change me"; $password = "change me";
//connect to salesforce $client = new SforcePartnerClient(); $client->createConnection($wsdl); $loginResult = $client->login($userName, $password);
$sObject = new sObject(); $sObject->type = 'Contact'; $sObject->fields = $contacts;
//this part adds the contact to salesforce $result = $client->create(array($sObject));
if ($result->success) { echo "Contact is added to salesforce contacts<br />"; echo "**************** ALL DONE ****************<br />"; exit; } else { $errMessage = $result->errors->message; echo $errMessage; }
} catch (exception $e) { // This is reached if there is a major problem in the data or with // the salesforce.com connection. Normal data errors are caught by // salesforce.com echo '<pre>' . print_r($e, true) . '</pre>'; return false; exit; }
} ?>
<form action="<˜=$_SERVER['PHP_SELF']™>" method="post"> <table width="100%"> <tr> <td align="right">* First Name: </td> <td align="left"><input name="fname" type="text" maxlength="50" align="right"></td> </tr> <tr> <td align="right">* Last Name: </td> <td align="left"><input name="lname" type="text" maxlength="50"></td> </tr> <tr> <td align="right">* Phone Mumber: </td> <td align="left"><input name="pnumber" type="text" maxlength="50"></td> </tr> <tr> <td align="right">* Email Address: </td> <td align="left"><input name="email" type="text" maxlength="50"></td> </tr> <tr> <td align="center" colspan="2"><input type="submit" name="submit"></td> </tr> </table> </form>
?>
|

08-07-2007, 09:30 AM
|
|
Administrator
|
|
Join Date: May 2007
Posts: 273
|
|
Randy please open a new thread for something like this in my other forum if you would not mind. I want to keep each new question to it's own thread, that way it makes it that much easier to maintain questions and answers. So can you please repost that thread in this forum >
http://www.mikesimonds.com/salesforc...g-discussions/
|
| Thread Tools |
|
|
| Rate This Thread |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:18 PM.
|
 |