我正在使用C#和Hammock libray与LinkedIn API进行一些集成。
我在尝试使用消息传递API时被卡住了。我收到一个错误,说“无法解析邮箱项目文档:错误:null后文件意外结束”。
看起来帖子内容是空的,我不知道...
下面是我的代码:
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>提前谢谢。
发布于 2011-04-12 00:27:20
在您的代码中,添加POST内容的代码行被注释掉了!
https://stackoverflow.com/questions/5624295
复制相似问题