我正在使用C#和Hammock libray与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>
提前致谢。
答案 0 :(得分:0)
在您的代码中,添加POST内容的行已注释掉了!