• gengel
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 5
    Replies
I'm entirely new to SOAP and the Salesforce API. I'm trying to set up a small class to login, upsert, and retrieve since those are the only functions I need for now. Unfortunately, I can't get past the login. I know my username and password are correct but it keeps telling me they aren't. My guess is I'm supposed to send some headers along with the username and password, or maybe encrypt them... I really don't know. So:

* Do I need to send headers in order to log in? What headers?
* Do I need to encrypt my values? What are the encryption rules?

Is there anyone here who's made their own Salesforce class for use with nuSOAP?
I'm trying to populate the ActivityDate field via a perl script.  The date is passed to the script via a cmd line argument.

Here's the snippet of code that submits the task (and works), but just doesn't work with ActivityDate:

my $result = $port->create('type' => 'Task',
            'Subject' => $f1,
            'WhatId' => $OppURL,
            'Status' => $f3,
            'OwnerId' => $OwnerId,
            'ActivityDate' => $f5);

$f5 is set to the argument passed in YYYY-MM-DD format.  For example:  2007-08-27

Am I doing something wrong?

Thanks for the help.

Mike
I have a problem to update a custom field in Date type with Perl. When I run the query to select some custom fields, all the fields of the return hash are strings even some of the fields are Date type. If I try to update the field which suppose to be Date type, it return the error message "INVALID_TYPE_ON_FIELD_IN_RECORD". Any suggestion??
 
Below is my code :
sub test
{
my $result, $nw_designerId;
my $q2 = "Select Id, FA_Reason__c, FA_Status__c, FA_Design_Owner__c, FA_Completed_Date__c from FA__c where Name = 'FA070427-000181'";
$result = $port->query('query' => $q2, 'limit' => '200');
print "We got " . $result->valueof('//queryResponse/result/size') . " back.\n";
foreach my $elem ($result->valueof('//queryResponse/result/records')) {
 print "$elem->{Id}, $elem->{FA_Reason__c}, $elem->{FA_Status__c}, $elem->{FA_Design_Owner__c}, $elem->{FA_Completed_Date__c} \n";
 $elem->{FA_Status__c} = "Open";
 $elem->{FA_Completed_Date__c} = '2006-12-19T19:51:12.174Z';
 my $foo = $port->update(%{$elem});
 print "$foo\n"; # should print "1" if $port->update() succeeded.
 }
}
 
Here is the error message :
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>
 <SOAP-ENV:Header
 >
   <SessionHeader
   >
     <sessionId xsi:type="xsd:string"
     >qDb2EUAjvgXw.LCb0f0L2NKx.BWxDv7gz3bcv_ZG7kgNuN6hbwE5EFaQtw_oR3obk4geuh36LW6VeH7JQ42op6QN9vOJezg802hoRYiHuRHjAF3vhkCDbMBZDURxjIkv4b4A8wCU</sessionId></SessionHeader></SOAP-ENV:Header>
 <SOAP-ENV:Body
 >
   <sforce:update xmlns:sfons="urn:sobject.partner.soap.sforce.com" xmlns:sforce="urn:partner.soap.sforce.com"
   >
     <sObjects xsi:type="sforce:FA__c"
     >
       <sforce:Id xsi:null="1" xsi:type="sforce:ID"/>
       <sforce:FA_Reason__c xsi:type="xsd:string"
       >Initial FA</sforce:FA_Reason__c>
       <sforce:FA_Status__c xsi:type="xsd:string"
       >Open</sforce:FA_Status__c>
       <sforce:Id xsi:type="xsd:string"
       >a0530000002fL8ZAAU</sforce:Id>
       <sforce:FA_Design_Owner__c xsi:type="xsd:string"
       >00530000000swzaAAA</sforce:FA_Design_Owner__c>
       <sforce:FA_Completed_Date__c xsi:type="xsd:string"
       >2006-12-19T19:51:12.174Z</sforce:FA_Completed_Date__c></sObjects></sforce:update></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Cache-Control: private
Date: Tue, 21 Aug 2007 21:52:00 GMT
Server:
Content-Type: text/xml; charset=utf-8
Client-Date: Tue, 21 Aug 2007 21:52:01 GMT
Client-Peer: 204.14.234.40: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. LIABILITY LTD.(c)97 VeriSign
Client-SSL-Cert-Subject: /C=US/ST=California/L=San Francisco/O=Salesforce.com, Inc./OU=Applications/OU=Terms of use at www.verisign.com/rpa (c)00/CN=na1-api.salesforce.com
Client-SSL-Cipher: RC4-MD5
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
 <soapenv:Body>
 <updateResponse xmlns="urn:partner.soap.sforce.com">
  <result>
   <errors>
    <fields>FA_Completed_Date__c</fields>
    <message>FA Completed Date: value not of required type: 2006-12-19T19:51:12.174Z</message>
    <statusCode>INVALID_TYPE_ON_FIELD_IN_RECORD</statusCode>
   </errors>
   <id xsi:null="true"/>
   <success>false</success>
  </result>
 </updateResponse>
 </soapenv:Body>
</soapenv:Envelope>
  • August 21, 2007
  • Like
  • 0