【发布时间】:2011-04-11 16:15:52
【问题描述】:
我正在使用 C# 和 Hammock 库与 LinkedIn API 进行一些集成。
我一直在尝试使用消息传递 API...我收到一条错误消息“无法解析邮箱项目文档:错误:null 后文件意外结束”。
我不知道 POST 内容会变空……
这是我的代码:
RestClient client = new RestClient();
client.Authority = "http://api.linkedin.com/v1";
client.Credentials = credentials;
//client.Method = WebMethod.Post;
byte[] msg = Encoding.Default.GetBytes(doc.OuterXml);
client.AddPostContent(msg);
RestRequest request = new RestRequest();
request.Path = "/people/~/mailbox";
request.Method = WebMethod.Post;
//request.AddPostContent(msg);
RestResponse response = client.Request(request);
我的 xml(在 msg 变量中)是:
<?xml version="1.0" encoding="UTF-8"?>
<mailbox-item>
<recipients>
<recipient>
<person path="/people/~" />
</recipient>
</recipients>
<subject>teste</subject>
<body>teste</body>
</mailbox-item>
提前致谢。
【问题讨论】: