sForce 2P out of 3P: Perl and PHP - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

sForce 2P out of 3P: Perl and PHP

Description:

sForce 2P out of 3P: Perl and PHP Presented by Byrne Reese Product Manager, TypePad Six Apart Lead Developer SOAP::Lite Project – PowerPoint PPT presentation

Number of Views:56
Avg rating:3.0/5.0
Slides: 17
Provided by: majo150
Category:
Tags: php | documentation | out | perl | sforce | soap

less

Transcript and Presenter's Notes

Title: sForce 2P out of 3P: Perl and PHP


1
sForce 2P out of 3P Perl and PHP
  • Presented by Byrne Reese
  • Product Manager, TypePad Six ApartLead
    Developer SOAPLite Project

2
Agenda
  • Take a closer look at the sForce Perl Project
  • Introducing php_gen_proxy

3
Why SOAPLite?
  • Pros
  • Simple API
  • PERLs utility goes way beyond the Web
  • Ubiquity of Perl
  • Excellent developer support, and 3rd party tool
    set
  • SOAP over HTTP, FTP, Jabber, and more
  • Cons
  • Document-Literal Support in Beta

4
SOAPLite A Quick Update
  • Current version 0.65 Beta 2
  • Changes in 0.65
  • Document-literal support
  • DIME support
  • Much improved documentation
  • Enhanced attachment management
  • Many interoperability fixes

5
Perl Salesforce Module
  • Originally written for last year's dreamForce
    conference
  • What has changed in 2004?
  • Support for all 4.0 operations (with 5.0 to come)
  • Added additional unit tests and code samples
  • Added much needed documentation

6
Perl Installation
  • Install SOAPLitegt perl MCPAN e install
    SOAPLite
  • Download Salesforce-0.54.tar.gz from
    http//majordojo.com/salesforce
  • Unpack Salesforce-0.54.tar.gz
  • Run the standardgt cd Salesforce-0.54gt perl
    Makefile.PLgt makegt make testgt make install

7
Perl login
  • Session ID is automatically persisted for
    subsequent calls
  • !/usr/bin/perl
  • use Salesforce
  • my service new SalesforceSforceService
  • my port service-gtget_port_binding('Soap')
  • port-gtlogin('username' gt byrne_at_majordojo.com,
  • 'password' gt xxxxxxxxx)
  • print My Session ID .port-gt'sessionId'.\n

8
Perl query
  • Perform a Query
  • !/usr/bin/perl
  • use Salesforce
  • my service new SalesforceSforceService
  • my port service-gtget_port_binding('Soap')
  • port-gtlogin('username' gt byrne_at_majordojo.com,
  • 'password' gt xxxxxxxxx)
  • result port-gtquery('query' gt "select Id,Name
    from Account",
  • 'limit' gt 10)

9
Perl query (cont.)
  • Parse the results
  • !/usr/bin/perl
  • use Salesforce
  • ...
  • result port-gtquery('query' gt SELECT Id,Name
    FROM Account,
  • 'limit' gt 10)
  • foreach my elem (result-gtvalueof('//queryRespons
    e/result/records'))
  • printf "s, s\n", elem-gtId,elem-gtName

10
Perl Additional Resources
  • Salesforce Module man page
  • Salesforce Perl Module Homehttp//majordojo.com/s
    alesforce/
  • SOAPLite HOWTOs Solutionshttp//majordojo.com
    /soaplite/
  • SOAPLite Project Homepagehttp//www.soaplite.co
    m/
  • OReillys Programming Web Services with Perl,
    Randy J. Ray and Paul Kulchenko

11
PHP Why Pear SOAP?
  • PHP is tailored for the Web
  • Simpler syntax
  • WSDL Support

12
PHP php_gen_proxy
  • What it does
  • Generates PHP code stubs that work against any
    SFDC WSDL
  • Why use it?
  • Pear SOAP's gen_proxy.php tool does not generate
    the necessary bindings to send SOAP Headers
  • A bug in Pear SOAP prevents Header definitons
    from being read properly in WSDLs

13
PHP Installation
  • Prerequisites
  • Pear SOAP
  • PHP 4.3.4 or greater (compiled with with-zlib
    and with-curl flag)
  • Install required Pear Modulesgt pear install -fa
    SOAP-0.8RC3

14
PHP Installation (cont.)
  • Download php_gen_proxy-0.50.tar.gz (Windows Zip
    file also available) fromhttp//majordojo.com/sa
    lesforce
  • Unpack php_gen_proxy-0.50.tar.gz
  • Patch SOAP/WSDLgt patch /usr/local/lib/php/SOAP/WS
    DL.php WSDL.patch
  • Generate Code Stubsgt php gen_sfdc_proxy.php
    ltwsdlgt
  • Code

15
PHP Sample Code
  • lt?php
  • require_once("SalesforceClient.php")
  • client new SalesforceClient()
  • result client-gtlogin(byrne_at_majordojo.com,xx
    xxxxx)
  • if (PEARisError(result))
  • echo "Error " . result-gtgetMessage() .
    "\n" exit
  • result client-gtquery("select
    Id,FirstName,LastName from Lead")
  • while (list(k1, record) each(result-gtrecords)
    )
  • printf("s s, s\n",record-gt'Id'0,
    record-gt'LastName',record-gt'FirstName')
  • ?gt

16
PHP Additional Resources
  • php_gen_proxy Homepagehttp//www.majordojo.com/sa
    lesforce/
  • PHP Project Homepagehttp//www.php.net
  • Pear Networkhttp//pear.php.net
  • Pear SOAP Homehttp//pear.php.net/package/SOAP
Write a Comment
User Comments (0)
About PowerShow.com