• ramasubramanian.ar
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html

I am tying to do a HEAD request. Based on the above document I created the signature but getting 403 forbidden message.
DateTime now = System.now();
String formattednow = now.formatGmt('yyyyMMdd')+'T'+now.formatGmt('hhmmss')+'Z';           
//Canonical string
String a = 'HEAD'+ '\n' + EncodingUtil.urlEncode('/bucketName/fileName.mp4', 'UTF-8') + '\n' + '\n' + 'host:s3.amazonaws.com'+'\n'+'x-amz-date:'+formattednow +'\n' + 'host;x-amz-date'+'\n'+EncodingUtil.convertToHex(Crypto.generateDigest('SHA-256', Blob.valueOf('')));
Blob b = Blob.valueOf(a);
String canonical = EncodingUtil.convertToHex(Crypto.generateDigest('SHA-256', b));
System.debug('canonical:::--'+canonical);

 //'2015-10-09T06:33:08.090Z'
String StringToSign = 'AWS4-HMAC-SHA256' + '\n' + formattednow + '\n' + '20151009/us-east-1/s3/aws4_request' + '\n' + canonical;

Blob b1 = crypto.generateMac('HmacSHA256',Blob.valueOf('AWS4'+'AWSSECRETKEY'), Blob.valueOf('20151009')); 
Blob b2 = crypto.generateMac('HmacSHA256',b1, Blob.valueOf('us-east-1'));
Blob b3 = crypto.generateMac('HmacSHA256',b2, Blob.valueOf('s3'));
Blob signInKey = crypto.generateMac('HmacSHA256',b3, Blob.valueOf('aws4_request'));
System.debug('AAA:::'+EncodingUtil.convertToHex(Crypto.generateMac('HmacSHA256', Blob.valueOf(StringToSign), signInKey)));

Do you find any mistake in the above code?
Hi All,

I am new to the OpenCTI and trying to execute the sforce.interaction. methods from an VS page. However none of the methods are getting executed. I am getting an error "Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://na16.salesforce.com') does not match the recipient window's origin ('https://c.na16.visual.force.com'). while clicking a button from the console"on Chrome  js console. And not getting any response on IE console. I have found many posts on this issue, however noone gave me the solution. Kindly request anyone to help on this issue

Regards
Sandeep 

I am trying to use a web service to connect to an external site and I keep on getting:

 

System.CalloutException: IO Exception: External server did not return any content

 

I was able to successfully import their wsdl and I was trying to do a simple ping operation. I tried the connection in soapUI and it was successful and returned a response.

 

One question I had was if Salesforce handles the <s:any /> complex type correctly. Their wsdl has:

 

      <s:element name="PingResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="PingResult">
              <s:complexType mixed="true">
                <s:sequence>
                  <s:any />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>

and the code it generates is:

 

    public class PingResult_element {
        private String[] apex_schema_type_info = new String[]{'YSI.Portal.SeniorHousing.WebServices','true','false'};
        private String[] field_order_type_info = new String[]{};
    }
    public class PingResponse_element {
        public seniorhousingWeb.PingResult_element PingResult;
        private String[] PingResult_type_info = new String[]{'PingResult','YSI.Portal.SeniorHousing.WebServices',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'YSI.Portal.SeniorHousing.WebServices','true','false'};
        private String[] field_order_type_info = new String[]{'PingResult'};
    }

Any help is appreciated!!

Hi,

In my apex script I make a copy of an original list with sObjects, to see at a later phase (eg when saving the objects) wether there has been a change of any of the fields by the user.

I use deepclone (clone(true,true)) to make the copy of the relevant objects which I add to the list. Immediately after the cloning, the objects are identical (assertequals of clone and original returns true), after showing them on a vf page with only outputfields they remain identical,

but after showing them in a vf page with inputfields they are seen different (assertequals of clone and original returns false), although all fields (including system fields like lastmodifieddate and id) are identical (assertequals of the individual fields returns true).

 

Anyone who recognizes this and could think of a way to handle this without having to compare each individual field to check for changes?