2

I was hoping one of you could help me with the use of AWS Kinesis. I have been pouring over the documentation and I am still unable to post a "blob" of data to a Kinesis stream.

In the API the standard POST request is as follows.

POST / HTTP/1.1
Host: kinesis.<region>.<domain>
x-amz-Date: <Date>
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=contenttype;
date;host;user-agent;x-amz-date;x-amz-target;x-amzn-requestid, Signature=<Signature>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.1
Content-Length: <PayloadSizeBytes>
Connection: Keep-Alive
X-Amz-Target: Kinesis_20131202.PutRecord
{
"StreamName": "exampleStreamName",
"Data": "XzxkYXRhPl8x",
"PartitionKey": "partitionKey"
}

Using "Postman" a google chrome app to make Http requests and filling in the appropriate information for the above fields I cannot for the life of me figure out how to make a successful data post to a stream. I was unable to do this successfully so i went on to do use the .NET SDK for visual studio.

I made a quick command line c# console application I am still having some issues.

My code: http://pastebin.com/cyJeC0vU

The error message, System.Xml.XmlException was unhandled, appears on line 61 of the code: http://pastebin.com/HEG7DmMw

Has anyone had a successful experience using AWS Kinesis. I would love to pick your brain / repay you somehow for a bit of tutoring.

Thanks again for all of your help!

4

1 回答 1

3

您收到的错误表明无法解析来自服务的响应。有一个线索是 SDK 从 JSON 解析器切换到 XML 解析器,因为响应看起来像 XML。这通常表明您在需要身份验证的代理后面,并且代理正在给您一条 HTML 错误消息。

您可以通过启动像 Fiddler 这样的协议分析器并观察请求流量来验证这一点。如果您的代理需要凭证,这里有一些关于将适用于 .NET 的 AWS 开发工具包与代理一起使用的文档:

为您的 AWS SDK for .NET 应用程序配置凭证

于 2014-04-16T22:43:19.960 回答