Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Problem with RepositoryClient

Avatar

Level 2
I have a PDF form that I copied/wrote to LiveCycle server folder using
RepositoryClient API (writeResource) from my local system. The Write
operation was successful. But I do not see this form when I
synchronize my folders from within Workbench. I do see it when I try
to read it using readResource method and also when I list all the
members in the folder.

How do I see this PDF form from the workbench ? Another thing I notice is that when I list the members of the folder where I am writing the resource to, for the new resource I wrote, I do not see a file with extension 'pdf_dci' that gets created for every form.

Here is my code.

String fileName = "C:\\My Documents\\WriteResource.pdf";
String LC_FOLDER_PATH = "/Applications/Test/1.0/Forms";
File iFile = new File(fileName);
try {
FileInputStream inputStream = new FileInputStream(iFile);

Properties connectionProps = new Properties();

                connectionProps.setProperty("DSC_DEFAULT_SOAP_ENDPOINT", "http://
hostname:8080");
                connectionProps.setProperty("DSC_TRANSPORT_PROTOCOL","SOAP");

                connectionProps.setProperty("DSC_SERVER_TYPE", "JBoss");

                connectionProps.setProperty("DSC_CREDENTIAL_USERNAME", "username");

                connectionProps.setProperty("DSC_CREDENTIAL_PASSWORD", "password");

                //Create a ServiceClientFactory object

                ServiceClientFactory myFactory =
ServiceClientFactory.createInstance(connectionProps);
                ResourceRepositoryClient repositoryClient = new
ResourceRepositoryClient(myFactory);

                // Create a RepositoryInfomodelFactoryBean needed for creating
resources
                RepositoryInfomodelFactoryBean repositoryInfomodelFactory = new
RepositoryInfomodelFactoryBean(null);

                   // Create the resource to be written to the folder
                /**     Resource testResource = repositoryInfomodelFactory.newResource(
                    new Id(),
                    new Lid(),
                    "testResource"
                        );**/
                // Set the resource’s description

                Resource testResource = new Resource();
                testResource.setId(new Id());
                testResource.setLid(new Lid());
                testResource.setName("xyz.pdf");
                testResource.setDescription("test resource");

                ResourceContent testContent =
repositoryInfomodelFactory.newResourceContent();

                Document doc = new Document(iFile,false);
                testContent.setDataDocument(doc);

                testResource.setContent(testContent);

                   // Write the resource to the folder
                repositoryClient.writeResource(LC_FOLDER_PATH, testResource);

                // Retrieve the resource’s URI
                String resourceUri = LC_FOLDER_PATH + "/" + testResource.getName();

                   // Retrieve the resource to verify that it was successfully
written
                Resource r = repositoryClient.readResource(resourceUri);
                List<Resource> members =
repositoryClient.listMembers(LC_FOLDER_PATH);
                for(Resource r1:members) {
                        System.out.println("r1 name =" + r1.getName());
                }
                   // Print the resource verification message
                System.out.println("Resource " + r.getName() + " was successfully
written.");

                }catch(Exception ex){ex.printStackTrace();}
        }


Thanks,

Jyothi

0 Replies