Skip to content

Commit

Permalink
Merge pull request #8 from dclendenan/master
Browse files Browse the repository at this point in the history
Upstream proxy support and unit test extensions.
  • Loading branch information
redhotpenguin committed Jun 10, 2013
2 parents a011eaa + cf1e462 commit 69a6ae1
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 27 deletions.
6 changes: 6 additions & 0 deletions Changes
@@ -1,5 +1,11 @@
Revision history for Perl extension WWW::Salesforce.

0.19 May 27 2013
- Added web proxy support ($WWW::Salesforce::WEB_PROXY=http://my.proxy.com:8080)
- added unit tests
- added the ability to override the API URL, for use within salesforce.com
- above by Dave Clendenan

0.18 Mar 22 2013
- Added logout() subroutine to end session for logged in user
- Added bye() subroutine to simple.pm to call logout()
Expand Down
32 changes: 28 additions & 4 deletions lib/WWW/Salesforce.pm
Expand Up @@ -12,17 +12,19 @@ use WWW::Salesforce::Deserializer;
use WWW::Salesforce::Serializer;

use vars qw(
$VERSION $SF_URI $SF_PREFIX $SF_PROXY $SF_SOBJECT_URI $SF_URIM $SF_APIVERSION
$VERSION $SF_URI $SF_PREFIX $SF_PROXY $SF_SOBJECT_URI $SF_URIM $SF_APIVERSION $WEB_PROXY
);

$VERSION = '0.18';
$VERSION = '0.19';

$SF_PROXY = 'https://www.salesforce.com/services/Soap/u/8.0';
$SF_URI = 'urn:partner.soap.sforce.com';
$SF_PREFIX = 'sforce';
$SF_SOBJECT_URI = 'urn:sobject.partner.soap.sforce.com';
$SF_URIM = 'http://soap.sforce.com/2006/04/metadata';
$SF_APIVERSION = '23.0';
# set webproxy if firewall blocks port 443 to SF_PROXY
$WEB_PROXY = ''; # e.g., http://my.proxy.com:8080

#
#**************************************************************************
Expand Down Expand Up @@ -328,8 +330,13 @@ sub get_client {
SOAP::Lite->readable($readable)
->deserializer( WWW::Salesforce::Deserializer->new )
->serializer( WWW::Salesforce::Serializer->new )
->on_action( sub { return '""' } )->uri($SF_URI)->multirefinplace(1)
->proxy( $self->{'sf_serverurl'} );
->on_action( sub { return '""' } )->uri($SF_URI)->multirefinplace(1);

if($WEB_PROXY) {
$client->proxy( $self->{'sf_serverurl'}, proxy => ['https' => $WEB_PROXY ] );
} else {
$client->proxy( $self->{'sf_serverurl'} );
}
return $client;
}

Expand Down Expand Up @@ -1010,6 +1017,11 @@ sub checkRetrieveStatus {
}


sub getErrorDetails {
my $self = shift;
my $result = shift;
return $result->valueof('//errors');
}

#magically delicious
1;
Expand Down Expand Up @@ -1298,6 +1310,18 @@ The search string to be used in the query. For example, "find {4159017000} in ph
=back
=item getErrorDetails( RESULT )
Returns a hash with information about errors from API calls - only useful if ($res->valueof('//success') ne 'true')
{
'statusCode' => 'INVALID_FIELD_FOR_INSERT_UPDATE',
'message' => 'Account: bad field names on insert/update call: type'
...
}
=back
=head1 EXAMPLES
Expand Down

0 comments on commit 69a6ae1

Please sign in to comment.