• darrenw_uk
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

I'm trying to construct a url in a controller and one of the parameters need to be AES128 encrypted, and then urlencoded. I've been given a base64encoded key to use, and I'm attempting to use Crypto.encryptWithManagedIV class to encrypt the param like so:

 

Blob encryptionKey = EncodingUtil.base64Decode('xxxxxxxxxxxxxxxxxx');
    String payloadStr = 'text to be encoded';
    Blob payload = Blob.valueof(payloadStr);
    Blob encryptedPayload = Crypto.encryptWithManagedIV('AES128', encryptionKey, payload);
    myUrl = 'http://www.mysite.com/myPage.aspx?a=' + EncodingUtil.urlEncode(encryptedPayload.Tostring(),'UTF-8');

 

The error I'm getting is Invalid private key. Must be 16 bytes.

 

 

Hi all

 

I've got a website which integrates with Salesforce using straightforward soql, but there are instances where this is quite cumbersome eg repeated round trips to recursively get account parent ids, until the top of the hierarchy is reached etc. For these sort of problems I thought an Apex web service woudl be ideal, as only one call would be required  and all the business logic could be hosted by SF.

 

My first step was to set up a free developer account and write a simple method to get a Lead by email address (using this as an example - http://www.devproconnections.com/article/aspnet2/force-com-for-asp-net-developers.aspx). I exported the wsdl from this account and and the enterprise wsdl from my production account and set up a test project which references both. I'm setting the sessionheader.session id to the sessionid yeilded by logging in via the enterprise wsdl, and then I get Invalid Session ID found in SessionHeader: Illegal Session. Session not found, missing session key: when calling my new method. However, the sessionid is populated and appears to be current as the website is working fine using this sessionid, making soql calls etc.

 

So firstly, is this the right way of approaching  this? Secondly, do you know why this error is occuring? Thirdly, if I can overcome this, will the web service have access to custom fields/objects in my production account, by virtue of the fact that I'm passing a valid sessionid from this account?

 

Hope that all makes sense! Any help/guidance much appreciated!

 

c#.net code below:

 

rootUsername = "xxxxxxxxxxxxxxxx";
            rootUserpw = "xxxxxxxxxxxxx";
            binding = new sfEnterprise.SforceService();
            sfEnterprise.LoginResult lr = binding.login(rootUsername, rootUserpw);
            binding.SessionHeaderValue = new sfEnterprise.SessionHeader();
            binding.SessionHeaderValue.sessionId = lr.sessionId;
            sessionExpires = DateTime.Now.Add(new TimeSpan(0, 0, 100, 0, 0));
            binding.Url = lr.serverUrl;

            getLeadInfo.getLeadInfoService glis = new getLeadInfo.getLeadInfoService();
            getLeadInfo.SessionHeader sessionHeader = new getLeadInfo.SessionHeader();
            sessionHeader.sessionId = lr.sessionId;

            glis.SessionHeaderValue = sessionHeader;

            getLeadInfo.Lead getLeadInfoResponse = new getLeadInfo.Lead();   //ERROR OCCURS HERE

 

 

Hey,

I am using asp.net and allowing user to create task using aspx file. now the data entered by the user has to be stored in salesforce. all things are working fine except when I make user to delete task and set the field IsDeleted=true it is NOT WORKING at all.

 

as even after setting IsDeleted field to true it is still showing false.

 

Why is not getting updated?

 

SforceService Obj_SforceService = new SforceService();


Task task = new Task();

task.Id = "00T90000003FXT4EAO";

task.IsDeleted = true;


SaveResult[] sr = Obj_SforceService.update(new sObject[] { task });


for (int j = 0; j < sr.Length; j++)
{
    if (sr[j].success)
        txtMessage.Text += " Succeed";
    else
    {
        txtMessage.Text +="Failed";
    }

}

 

Above programs works fine with any issue and it is showing the message "Succeed" in textbox. but still it is not updating record and IsDeleted is still false. why?