Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

1270

December 8th, 2016 05:00

ViPR Object Services AWS SDK

Good day All

I am having an issue with the ListObjectResponse class in my program it keeps throwing an exception that tells me about something wrong in the XML document, does not stipulate which one.

I am using .NET framework 4.5 with EMC.ViPR.DataServices.AWSSDK v1.0.0 - I don't know whether these clash.

Exception message below:

System.InvalidOperationException: There is an error in XML document (12, 54). ---> System.FormatException: String was not recognized as a valid DateTime.


   at System.DateTimeParse.ParseExactMultiple(String s, String[] formats, DateTimeFormatInfo dtfi, DateTimeStyles style)


   at System.DateTime.ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style)


   at Amazon.S3.Model.S3Object.set_LastModified(String value)


   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderListObjectsResponse.Read6_S3Object(Boolean isNullable, Boolean checkType)


   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderListObjectsResponse.Read7_ListObjectsResponse(Boolean isNullable, Boolean checkType)


   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderListObjectsResponse.Read8_ListObjectsResponse()


   --- End of inner exception stack trace ---


   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)


   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)


   at Amazon.S3.AmazonS3Client.processRequestResponse (HttpWebResponse httpResponse, S3Request request, Type t, T& response, Exception& cause)


   at Amazon.S3.AmazonS3Client.handleHttpResponse (S3Request userRequest, HttpWebRequest request, HttpWebResponse httpResponse, Int32 retries, Int64 lengthOfRequest, T& response, Exception& cause, HttpStatusCode& statusCode)


   at Amazon.S3.AmazonS3Client.getResponseCallback (IAsyncResult result)


   at Amazon.S3.AmazonS3Client.endOperation (IAsyncResult result)


   at Amazon.S3.AmazonS3Client.EndListObjects(IAsyncResult asyncResult)


   at Amazon.S3.AmazonS3Client.ListObjects(ListObjectsRequest request)


   at ObjectStore1.frmStart.btnGetData_Click(Object sender, EventArgs e) in c:\Users\Chuma\Documents\Visual Studio 2012\Projects\ObjectStore1\ObjectStore1\Form1.cs:line 124

Code is below:

private void btnGetData_Click(object sender, EventArgs e)



var client = CreateClient();


string bucketName = "bucket02";


try




ListObjectsRequest request = new ListObjectsRequest();




//request.Prefix = "Test.txt";


ListObjectsResponse response = new ListObjectsResponse();



foreach (S3Object entry in response.S3Objects)



//richTextBox1.Text.LastModified.ToString());





//foreach (var entry in response.S3Objects)


//{


//    MessageBox.Show(entry.Key + " " + entry.Size.ToString() + " " + entry.LastModified);


//}



//var getObjectRequest = new GetObjectRequest()


//{


//    BucketName = "bucket02",


//    Key = "Test.txt"


//};


//using (var getObjectResponse = client.GetObject(getObjectRequest))


//{


//    string objectName = getObjectResponse.Key;


//    MessageBox.Show(objectName.ToString());


//}



//GetObjectRequest request = new GetObjectRequest();


//request.BucketName = "bucket02";


//request.Key = "NewFile";


//GetObjectResponse response = client.GetObject(request);



//saveFileDialog1.ShowDialog();



//response.WriteResponseStreamToFile(saveFileDialog1.FileName + ".pdf");



catch (Exception ee)




Would appreciate any help.

Thank you

No Responses!
No Events found!

Top