views:

265

answers:

1

Hello all,

We are building an application which stores data in an S3 bucket. However, we are having problems with the PutObject method. Here is the xml packet we are sending out:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;
   <soap:Body>
      <PutObject xmlns="http://doc.s3.amazonaws.com/2006-03-01"&gt;
         <Bucket>lills</Bucket>
         <Key>lills123</Key>
         <Metadata>
            <Name>Content-Type</Name>
            <Value>text/plain</Value>
         </Metadata>
         <Metadata>
            <Name>title</Name>
            <Value>lills</Value>
         </Metadata>
         <Data>aGEtaGE=</Data>
         <ContentLength>5</ContentLength>
         <AWSAccessKeyId>key</AWSAccessKeyId>
         <Timestamp>2008-11-12T06:23:17Z</Timestamp>
         <Signature>signature</Signature>
      </PutObject>
   </soap:Body>
</soap:Envelope>

And this is the response we are getting back from S3:

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Client.badRequest</faultcode>
         <faultstring>Malformed request</faultstring>
         <detail/>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

Can anyone tell me what the problem with the SOAP packet is?

Thanks in advance, Devan

+2  A: 

If you want to send the data in the SOAP message itself, you need to use PutObjectInline, and not PutObject (which expects the data to be a DIME attachment).

see PutObjectInline in the s3 docs.

superfell