• JacksonP
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 9
    Replies
Has anyone been able to automate login to SFDC using Perl Mechanize or LWP? I have spent a bit of time on it with no luck. I need to scrape some data off a dashboard. Many thanks for your assistance. Regards,
I'm struggling translating the java format from the API doc to a Perl call.
use Salesforce;
use SOAP::Lite +trace => 'debug';

my $user="jacksxxxxxxxxx\@gmail.com";
my $pass="Susan123RfxxxxxxxxxxxxEQDV2js";

my $service = new Salesforce::SforceService;
my $port = $service->get_port_binding('Soap');
$port->login('username' => $user,'password' => $pass)
|| die "Could not login to salesforce.com";

my $result = $port->query("SELECT Id, Name, BillingCity FROM Account",3);

---------------------

No matter how I set the query I continue to get an error back.

SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error

SOAP Debug below, continues to point to an invalid batch size which I don't think is true since I set it to all kinds of numbers including not setting it at all.
---------------------

510900D80000000LuLV!AQgAQJOTPgyn7B3NGKkm2R1z4D.b.ZiUY4VUswSIUX_WoohZHQc0G3
1mMPcsFffZtn10nOZOZVXMS8NIgcX0PiP3PScHM.Xjons>mesp2:query xmlns:namesp2="urn:partner.soap.sforce.com">amesp2:query>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Date: Fri, 05 Dec 2008 22:08:02 GMT
Server:
Content-Type: text/xml; charset=utf-8
Client-Date: Fri, 05 Dec 2008 22:08:02 GMT
Client-Peer: 204.14.234.109:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign
International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILI
TY LTD.(c)97 VeriSign
Client-SSL-Cert-Subject: /C=US/ST=California/L=San Francisco/O=Salesforce.com, I
nc./OU=Applications/CN=na6-api.salesforce.com
Client-SSL-Cipher: RC4-MD5
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked


s:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSc
hema-instance">


soapenv:Server
INVALID_BATCH_SIZE: Unknown batch size null


INVALID_BATCH_SIZE
Unknown batch size null




I can't seem to get past the basics, spending lots of time on this. Just want to get one query to work with some pointers to the correct documentation and I'm off doing something useful.

Starting with:



use Salesforce;

my $user="bubba\@gmail.com";
my $pass="SusaniscoolRfA44QuF7I97QlJr0KEQDV2js";

my $service = new Salesforce::SforceService;
my $port = $service->get_port_binding('Soap');
$port->login('username' => $user,'password' => $pass)
|| die "Could not login to salesforce.com";

my $result = $port->query("select FirstName, LastName from Contact",100);
print "$result\n";
print "We got " . $result->valueof('//queryResponse/result/size') . " back.\n";



Returns this:



C:\Perl Files\SFDC>test.pl
1
Use of uninitialized value in concatenation (.) or string at C:\Perl Files\SFDC
test.pl line 20.
We got back.



Now this makes me quite curious where the //queryResponse/result/size is coming from. Is there a doc that explains these elements? I have not located yet.

This does not work either:


foreach my $elem ($result->valueof('//queryResponse/result/records'))
{
printf "%s, %s\n", $elem->{Id}[0],$elem->{AccountId};


And I really don't mean to be negative demonstrating all that does not work but apparently Perl is still quite challenged here.

At the end of the day, if one exists. I would like to simply insert some leads and associate a task with them so the sales folks get a nice alert. I can do this with the loader and spreadsheets but it is a pretty manual process. If you can point me to some working scripts, pretty much -anything- that actually works I would be most grateful.

I must say this is the coolest and most flexible service I have encountered, just need a little help from my friends.

Regards,

Jacksonp2008@gmail.com
use Salesforce;
use SOAP::Lite +trace => 'debug';

my $user="jacksxxxxxxxxx\@gmail.com";
my $pass="Susan123RfxxxxxxxxxxxxEQDV2js";

my $service = new Salesforce::SforceService;
my $port = $service->get_port_binding('Soap');
$port->login('username' => $user,'password' => $pass)
|| die "Could not login to salesforce.com";

my $result = $port->query("SELECT Id, Name, BillingCity FROM Account",3);

---------------------

No matter how I set the query I continue to get an error back.

SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error

SOAP Debug below, continues to point to an invalid batch size which I don't think is true since I set it to all kinds of numbers including not setting it at all.
---------------------

510900D80000000LuLV!AQgAQJOTPgyn7B3NGKkm2R1z4D.b.ZiUY4VUswSIUX_WoohZHQc0G3
1mMPcsFffZtn10nOZOZVXMS8NIgcX0PiP3PScHM.Xjons>mesp2:query xmlns:namesp2="urn:partner.soap.sforce.com">amesp2:query>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
Date: Fri, 05 Dec 2008 22:08:02 GMT
Server:
Content-Type: text/xml; charset=utf-8
Client-Date: Fri, 05 Dec 2008 22:08:02 GMT
Client-Peer: 204.14.234.109:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /O=VeriSign Trust Network/OU=VeriSign, Inc./OU=VeriSign
International Server CA - Class 3/OU=www.verisign.com/CPS Incorp.by Ref. LIABILI
TY LTD.(c)97 VeriSign
Client-SSL-Cert-Subject: /C=US/ST=California/L=San Francisco/O=Salesforce.com, I
nc./OU=Applications/CN=na6-api.salesforce.com
Client-SSL-Cipher: RC4-MD5
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked


s:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSc
hema-instance">


soapenv:Server
INVALID_BATCH_SIZE: Unknown batch size null


INVALID_BATCH_SIZE
Unknown batch size null




Hi
 
 Please find the following steps, I have done this for installing the Plerl Module(WWW-Salesforce-0.082).
 
Kindly check the following error message.
 
=============================================================
C:\perl\lib\WWW-Salesforce-0.082>perl Makefile.PL
Several tests need to be run in order to test the Salesforce Perl module.
You MUST supply a Saleforce username and password in order to proceed.
All tests will fail if you do not provide a valid username and password.
This username and password combination is used ONLY for testing purposes.
Enter user name:  xxxxxx.xxxx@xxxx.xxx
Enter password:  xxxxxx
Writing Makefile for WWW::Salesforce
=============================================================
C:\perl\lib\WWW-Salesforce-0.082>nmake
Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
=============================================================
C:\perl\lib\WWW-Salesforce-0.082>nmake test
Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.
        C:\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'bl
ib\lib', 'blib\arch')" t/*.t
t/WWW-Salesforce....ok 1/29500 Can't locate object method "new" via package "LWP
::Protocol::https::Socket" at C:\perl\lib\WWW-Salesforce-0.082\blib\lib/WWW/Sale
sforce.pm line 468
# Looks like you planned 29 tests but only ran 1.
# Looks like your test died just after 1.
t/WWW-Salesforce....dubious
        Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED tests 2-29
        Failed 28/29 tests, 3.45% okay
Failed Test        Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
t/WWW-Salesforce.t  255 65280    29   56  2-29
Failed 1/1 test scripts. 28/29 subtests failed.
Files=1, Tests=29,  1 wallclock secs ( 0.00 cusr +  0.00 csys =  0.00 CPU)
Failed 1/1 test programs. 28/29 subtests failed.
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0xff'
Stop.
C:\perl\lib\WWW-Salesforce-0.082>
=============================================================
 
Please reply me asap.
 
Thanks & Regards
C.G.Yuvaraj
 
Hello,
 
I am using the SalesForce.pm module to pull down some data using the API.  I want to store the SalesForce ID (which is a character field), but when I read the value using the perl API, I get the Id values back as:  ARRAY(0x35b8370), etc.
 
I'm using the example code from another post to hit the api and populate an array to return the data, such as:
 
Code:
my @records = QuerySF("select * from Opportunity");
foreach my $rec (@records)
{
      print "$rec->{Id}";
}

sub QuerySF 
{ 
 my $soql = shift;  
 my $lim = '2000'; 
 my $q = $sf->query( query =>$soql, limit => $lim );
 my @trans = $q->valueof('//records');
  
 while ( 'false' eq $q->valueof('//done') ) 
 { 
  # query more
  $q = $sf->queryMore( queryLocator => $q->valueof('//queryLocator'), limit => $lim ); 
  my @more = $q->valueof('//records');
  push @trans, @more;
 } 
 return @trans;
}

 
any ideas?  I'm fairly new to Perl, so perhaps I'm missing something.
 
thank you!