Java Exchange 400上载会议时出错
我正在尝试使用Android中的exchange 2010构建一个book your meeting应用程序。 我正在使用activesync来熟悉自己。 到目前为止,我已设法使ResolveRecipients、SendMail和FolderSync命令正常工作。但是当我尝试的时候 要上传会议请求,我收到一个400错误请求。我正在使用 作为参考 我的xmlJava Exchange 400上载会议时出错,java,android,outlook,exchange-server-2010,activesync,Java,Android,Outlook,Exchange Server 2010,Activesync,我正在尝试使用Android中的exchange 2010构建一个book your meeting应用程序。 我正在使用activesync来熟悉自己。 到目前为止,我已设法使ResolveRecipients、SendMail和FolderSync命令正常工作。但是当我尝试的时候 要上传会议请求,我收到一个400错误请求。我正在使用 作为参考 我的xml <?xml version="1.0" encoding="utf-8"?> <Sync xmlns:calendar=
<?xml version="1.0" encoding="utf-8"?>
<Sync xmlns:calendar="Calendar" xmlns="AirSync">
<Collections>
<Collection>
<SyncKey>1425334024</SyncKey>
<CollectionId>4</CollectionId>
<GetChanges>1</GetChanges>
<Commands>
<Add>
<ClientId>5644895</ClientId>
<ApplicationData>
<calendar:TimeZone>tv7//ygAVQBUAEMAKwAwADUAOgAzADAAKQAgAEMAaABlAG4AbgBhAGkALAAgAEsAbwBsAGsAYQB0AGEALAAgAE0AdQAAAAAAAAAAAAAAAAAAAAAAAAAAACgAVQBUAEMAKwAwADUAOgAzADAAKQAgAEMAaABlAG4AbgBhAGkALAAgAEsAbwBsAGsAYQB0AGEALAAgAE0AdQAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</calendar:TimeZone>
<calendar:StartTime>20130109T100000Z</calendar:StartTime>
<calendar:Subject>TestMeeting</calendar:Subject>
<calendar:UID>040000008200E90074C5B7101A82E0080000000036BD76EAAAD5CA01000000000000000010000000C45185F686A5D542B20BF2CE2F477D55</calendar:UID>
<calendar:Attendees>
<calendar:Attendee>
<calendar:Email>Test@test.com</calendar:Email>
<calendar:Name>JohnDoe</calendar:Name>
<calendar:AttendeeStatus>0</calendar:AttendeeStatus>
<calendar:AttendeeType>1</calendar:AttendeeType>
</calendar:Attendee>
</calendar:Attendees>
<calendar:Location>My Office</calendar:Location>
<calendar:EndTime>20130109T110000Z</calendar:EndTime>
<calendar:Sensitivity>0</calendar:Sensitivity>
<calendar:BusyStatus>1</calendar:BusyStatus>
<calendar:AllDayEvent>0</calendar:AllDayEvent>
<calendar:MeetingStatus>1</calendar:MeetingStatus>
</ApplicationData>
</Add>
</Commands>
</Collection>
</Collections>
</Sync>
有没有我遗漏的标题?xml是否有任何错误?如果有人能提供一些线索,我将不胜感激。
我在标题中使用的是activesync版本12.1。xml看起来不错。确保正确地将xml转换为wbxml。若要仔细检查,请尝试转换回xml并查看是否返回原始字符串。从未使用过此选项,但日历中的双斜杠:xml中的时区将是我查看的位置。这是我同步日历文件夹时从服务器获得的时区值。即使我删除了时区字段,我仍然会得到相同的错误:(
private HttpPost createHttpPost(String uri, String requestXML,
boolean includePolicyKey) throws Exception {
// Set the common headers
HttpPost httpPost = new HttpPost(uri);
httpPost.setHeader("User-Agent", "Android");
httpPost.setHeader("Accept", "*/*");
httpPost.setHeader("Content-Type", "application/vnd.ms-sync.wbxml");
//httpPost.setHeader("Content-Type", "message/rfc822");//message/rfc822
// If we are connecting to Exchange 2010 or above
// Lets tell the Exchange server that we are a 12.1 client
// This is so we don't have to support sending of additional
// information in the provision method
if(getActiveSyncVersionFloat() >= 14.0)
httpPost.setHeader("MS-ASProtocolVersion", "12.1");
// Else set the version to the highest version returned by the
// Exchange server
else
httpPost.setHeader("MS-ASProtocolVersion", getActiveSyncVersion());
//Log.d(TAG, mActiveSyncVersion);
httpPost.setHeader("Accept-Language", "en-us");
httpPost.setHeader("Authorization", mAuthString);
// Include policy key if required
if (includePolicyKey)
httpPost.setHeader("X-MS-PolicyKey", mPolicyKey);
// Add the XML to the request
if (requestXML != null) {
//Log.d(TAG, requestXML);
// Set the body
// Convert the XML to WBXML
ByteArrayInputStream xmlParseInputStream = new ByteArrayInputStream(
requestXML.toString().getBytes());
java.io.ByteArrayOutputStream output = new java.io.ByteArrayOutputStream();
wbxml.convertXmlToWbxml(xmlParseInputStream, output);
byte[] bytes = output.toByteArray();
ByteArrayEntity myEntity = new ByteArrayEntity(bytes);
myEntity.setContentType("application/vnd.ms-sync.wbxml");
httpPost.setEntity(myEntity);
}
return httpPost;
}