切换到宽版
  • 10849阅读
  • 1回复

[求助]exchange二次开发的更新操作 [复制链接]

上一主题 下一主题
 
只看楼主 倒序阅读 0楼  发表于: 2012-08-17
ExchangeServicePortType exChangeServiceProxy = getFactory()
     .getExchangeServerPort();  
   UpdateItemType updateItemType = new UpdateItemType();  
   //设置changekey和uid
   ItemChangeType itemChangeType = new ItemChangeType();
   itemChangeType.setItemId(itemIdType);
  
   //设置更新的calendar对象
   NonEmptyArrayOfItemChangesType updateItemsType = new NonEmptyArrayOfItemChangesType();
   NonEmptyArrayOfItemChangeDescriptionsType itemChangeDescriptionsType = new NonEmptyArrayOfItemChangeDescriptionsType();
   List<ItemChangeDescriptionType> itemChangeDescriptionTypesList = itemChangeDescriptionsType.getAppendToItemFieldOrSetItemFieldOrDeleteItemField();
   //更新的calendar对象
   AppendToItemFieldType setItemFieldType = new AppendToItemFieldType();
   CalendarItemType appointment = new CalendarItemType();
   BodyType bodyType = new BodyType();
   bodyType.setBodyType(BodyTypeType.TEXT);
   bodyType.setValue("11111111");
   appointment.setBody(bodyType);
   appointment.setItemClass("IPM.Appointment");
   appointment.setSubject("开会111");
   appointment.setLocation("meeting001");
   SimpleDateFormat dateFormat = new SimpleDateFormat(
     "yyyy-MM-dd HH:mm:ss");
   appointment.setItemId(itemIdType);
   Date startTime = dateFormat.parse("2012-08-17 17:00:00");
   Date endTime = dateFormat.parse("2012-08-17 18:00:00");
   appointment.setStart(DateUtil.getXMLCalendar(startTime));
   appointment.setEnd(DateUtil.getXMLCalendar(endTime));
   setItemFieldType.setCalendarItem(appointment);
   //设置webservice的命名空间
   PathToUnindexedFieldType ptuftDisplayName = new PathToUnindexedFieldType();
   ptuftDisplayName.setFieldURI(UnindexedFieldURIType.CALENDAR_ALLOW_NEW_TIME_PROPOSAL);
  
  
   QName qName = new QName("http://schemas.microsoft.com/exchange/services/2006/types", "Path");
   JAXBElement<PathToUnindexedFieldType> element = new JAXBElement<PathToUnindexedFieldType>(qName, PathToUnindexedFieldType.class, ptuftDisplayName);
  
   setItemFieldType.setPath(element);
   itemChangeDescriptionTypesList.add(setItemFieldType);
   itemChangeType.setUpdates(itemChangeDescriptionsType);
   //设置updateItemType的其他属性
   updateItemsType.getItemChange().add(itemChangeType);
   updateItemType.setItemChanges(updateItemsType);
   updateItemType.setConflictResolution(ConflictResolutionType.AUTO_RESOLVE);
   updateItemType.setSendMeetingInvitationsOrCancellations(CalendarItemUpdateOperationType.SEND_TO_CHANGED_AND_SAVE_COPY);
   //System.out.println(updateItemType);
   Holder<UpdateItemResponseType> updateItemResult = new Holder<UpdateItemResponseType>(new UpdateItemResponseType());
   Holder<ServerVersionInfo> serverVersion = new Holder<ServerVersionInfo>(new ServerVersionInfo());
   exChangeServiceProxy.updateItem(updateItemType, updateItemResult, serverVersion);

这个我关于更新约会的方法,但报如下错误:

javax.xml.ws.soap.SOAPFaultException: 发生了内部服务器错误。
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy40.updateItem(Unknown Source)
at a.ExchangeManager.updateMeetingForExchange(ExchangeManager.java:444)
at a.ExchangeManager.main(ExchangeManager.java:475)

请问该怎么做
我cxf将wsdl文件称webservice客户端接口。

或者有谁有源码(无论是java还是C#都可以)
分享到
只看该作者 1楼  发表于: 2013-02-20
快速回复
限60 字节
 
上一个 下一个