Women in Technology

Hear us Roar



Article:
  Using the Salesforce.com API
Subject:   Not Able to get any information from salesforce after connection
Date:   2008-09-26 03:38:21
From:   Prasanna14
Problem: I am Able to connect to salesforce after changing the proxy from https:// to http:// but after that i am not able to query the salesforce , program aborts saying 500:connections Refused , I used the security token also but no luck

Then I tried using print statements(in the modules) in "SUB get_session_header (print @_)" of Salesforce.pm , and print statements in "SUB NAME" of SOAP::DATA (print "self name $self->{_name} \n"; and print $self->value(@_)."\n"; before the return statements in the sub)

I got the following output
[sit:crm:batch:intcrm:idwsit1m36] perl salesforce.pl
self name username
SOAP::Data=HASH(0x839aa58)
self name password
SOAP::Data=HASH(0x839aa4c)
self name login

self name Body
SOAP::Data=HASH(0x839ade8)
self name Envelope
SOAP::Data=HASH(0x8133134)
self name
SOAP::Data=HASH(0x839ade8)
self name
SOAP::Data=HASH(0x839aa58)
connected
WWW::Salesforce=HASH(0x811aea0)self name sessionId
SOAP::Header=HASH(0x84b9d60)
self name SessionHeader
SOAP::Header=HASH(0x839a9f8)
self name getUserInfo

self name Header
SOAP::Data=HASH(0x84ba294)
self name Body
SOAP::Data=HASH(0x8132a74)
self name Envelope
SOAP::Data=HASH(0x880e41c)
self name
SOAP::Data=HASH(0x84ba294)
self name
SOAP::Header=HASH(0x839a9f8)
500 Connect failed: connect: Connection refused; Connection refused at /etrade/pkgs/linux/intel/perlmods_intcrm/5.8.8.rhas3.x86/lib/site_perl//5.8.8/WWW/Salesforce.pm line 439
The line# 439 refers to
" my $r = $client->getUserInfo( $self->get_session_header() );" in Salesforce.p,

Please help me to solve this , I am clueless here.("After the getuserinfo in the trace it is blank , the same happened for query also)

Thanks and sorry to disturb you,
Prasanna
My code:
use WWW::Salesforce;
#use salesforce;
use Crypt::SSLeay;
my $sforce = WWW::Salesforce->login( username => 'username', password => 'password+securitytoken' ) or die "not connectedte $!";
print " connected \n";
$sforce->getUserInfo('username');
my $query = "SELECT Id,Name FROM Account";
my $result = $sforce->do_query("SELECT Id,Name FROM Account");
my $result = $sforce->search('searchString' => $query);