function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
davidndavidn 

Help with WebServiceCallout

I am currently trying to integrate with the Amazon AWS Apex code. Specifically, I'm trying to use the CopyObject method in the S3 class. It seems to fail on the WebServiceCallout.invoke call. First off, I can't find any documentation on the WebServiceCallout class. It doesn't appear anywhere in the Apex Code Language Reference - http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm. Where can one find documentation on this class?

 

The error I'm getting is:

System.CalloutException: Web service callout failed: Unable to parse callout response. Apex type not found for element http://s3.amazonaws.com/doc/2006-03-01/=CopyObjectResponse

 

I'm not sure how to further debug this problem. Any help would be appreciated.

 

-David

Prajapati.LakhanPrajapati.Lakhan

Hi Did you get solution to this problem. If yes please post the solution.

 

Thanks,

Lakhan

A MeghnathiA Meghnathi
There are few mistakes in S3 class provided by Amazon toolkit.

Replace following class in your S3 class.

-----------------------------------------------------------------------------------------------------------------
public class CopyObjectResponse_element {
        public S3.CopyObjectResult CopyObjectResponse;
        private String[] CopyObjectResponse_type_info = new String[]{'CopyObjectResponse','http://s3.amazonaws.com/doc/2006-03-01/','CopyObjectResult','1','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://s3.amazonaws.com/doc/2006-03-01/','true'};
        private String[] field_order_type_info = new String[]{'CopyObjectResponse'};
    }

------------------------------------------------------------------------------------------------------------

public S3.CopyObjectResult CopyObject(String SourceBucket,String SourceKey,String DestinationBucket,String DestinationKey,String MetadataDirective,S3.MetadataEntry[] Metadata,S3.AccessControlList AccessControlList,DateTime CopySourceIfModifiedSince,DateTime CopySourceIfUnmodifiedSince,String[] CopySourceIfMatch,String[] CopySourceIfNoneMatch,String StorageClass,String AWSAccessKeyId,DateTime Timestamp,String Signature,String Credential) {
            S3.CopyObject_element request_x = new S3.CopyObject_element();
            S3.CopyObjectResponse_element response_x;
            request_x.SourceBucket = SourceBucket;
            request_x.SourceKey = SourceKey;
            request_x.DestinationBucket = DestinationBucket;
            request_x.DestinationKey = DestinationKey;
            request_x.MetadataDirective = MetadataDirective;
            request_x.Metadata = Metadata;
            request_x.AccessControlList = AccessControlList;
            request_x.CopySourceIfModifiedSince = CopySourceIfModifiedSince;
            request_x.CopySourceIfUnmodifiedSince = CopySourceIfUnmodifiedSince;
            request_x.CopySourceIfMatch = CopySourceIfMatch;
            request_x.CopySourceIfNoneMatch = CopySourceIfNoneMatch;
            request_x.StorageClass = StorageClass;
            request_x.AWSAccessKeyId = AWSAccessKeyId;
            request_x.Timestamp = Timestamp;
            request_x.Signature = Signature;
            request_x.Credential = Credential;
            Map<String, S3.CopyObjectResponse_element> response_map_x = new Map<String, S3.CopyObjectResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://s3.amazonaws.com/doc/2006-03-01/',
              'CopyObject',
              'http://s3.amazonaws.com/doc/2006-03-01/',
              'CopyObjectResponse',
              'S3.CopyObjectResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.CopyObjectResponse;
        }



Hope this will help you.
Thanks,
Anil