http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/wwhelp/wwhimpl/common/html/wwhelp....
http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/javadoc/com/adobe/repository/bindings/R...
Hello,
I'm trying to update XDP resources on Adobe LiveCycle Server ES8.2,the code snap is below
-----------------------------------------------------------------------------------------------------------------------------
ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(
serviceClientFactory);
String resourceURI = "/Forms/test.xdp";
Document doc = repositoryClient.readResourceContent(resourceURI);
String xmlString = readDocument(doc).toString();
//locate the Text content by the variable name "content_test"
int fromIndex = xmlString.indexOf("content_test");
fromIndex = xmlString.indexOf("</draw>", fromIndex);
//insert the value content "Hello Adobe LiveCycle"
StringBuffer sbf = new StringBuffer(512);
sbf.append("<value>");
sbf.append("Hello Adobe LiveCycle");
sbf.append("</value>");
sbf.append(xmlString.substring(fromIndex));
Document dataDocument = new Document(sbf.toString().getBytes());
Resource resource = repositoryClient.readResource(resourceURI);
ResourceContent resourceContent = resource.getContent();
//set the updated document into the resource
resourceContent.setDataDocument(dataDocument);
resource.setContent(resourceContent);
//update the resource
repositoryClient.updateResource(resourceURI, resource, true);
-----------------------------------------------------------------------------------------------------------------------------
The code above tries to load a XDP form template from LiveCycle repository, there is an empty Text area named "content_test" on the XDP form template. What I want to do is to insert a value content into the XDP and then update the resource on LiveCycle server. The result is only the version of the XDP on server is increaced, but the XDP form seems to be cleard totally, all of the objects on the XDP form are lost, sounds like I created a new XDP. I tried the "writeResource" API and I only got a empty XDP form as well. Is there any parameters or properties or preconditions I ignored in the implementation? Please help me to sort out the things. Any of your suggetions will be very appreciated!