[SalesForce] Rendering an image from Amazon S3 on VF page

Iam using Amazon toolkit to integrate SF with Amazon S3.

I want to render the content(image) of files in a bucket when bucket is selected from a selectlist.
Like ListBucket, I am calling a method getObject'which in turn calls the webservice operation GetObject
from the S3 class.
I can see the request and response(200) in my developer console but there is an exception:

ERROR: Web service callout failed: Unable to parse callout response. Apex type not found for element Status.enter image description here

Can someone help me to resolve this please.?

[EDIT]

This is The method which is in controller which further makes a call to a method of S3 class which performs a web service callout.


public PageReference GetObject()
{
try{ Datetime now = Datetime.now();
String Delimiter = null;
Boolean GetMetadata =true;
Boolean GetData=true;
Boolean InlineData=true;
System.debug('GetObject for bucket: ' + bucketToList);

//This performs the Web Service call to Amazon S3 and retrieves all the objects in the specified bucket

        S3.GetObjectResult response = as3.GetObject(bucketToList,'demo4'   ,GetMetadata,GetData,InlineData,as3.key,now,as3.signature('GetObject',now),as3.secret);

        return null;
     }
        catch(Exception ex){
        System.debug('EXCEPTION: ' + ex);
        getobjectErrorMsg =    ex.getMessage();
        ApexPages.addMessages(ex);
        return null; 

    }
    }
}

Best Answer

Ok , so I have resolved the error above after following the link: https://developer.salesforce.com/forums/ForumsMain?id=906F00000008xNYIAY

where I needed to Change GetObjectResult orginal code to also get 'status' and 'field_order'.

Now I have the issue of rendering the image content on page . I have the response string(image content) .

<apex:image value="data:image;base64,{!imagecontent}" />

The cntroller has getObject() with following code snippet

   S3.GetObjectResult response = as3.GetObject(bucketToList,'demo41' ,GetMetadata,GetData,InlineData,as3.key,now,as3.signature('GetObject',now),as3.secret);
  String imagecontent = response.data;

Is it the right way to go?

Related Topic