Forum Stats

  • 3,757,041 Users
  • 2,251,189 Discussions
  • 7,869,700 Comments

Discussions

Error in Downloading file from ucm to local directory using ridc

3698041
3698041 Member Posts: 7
edited Feb 8, 2019 9:55AM in WebCenter Content

Hi Experts,

I am using RIDC to download the files from content server below is my code given :

        

                  IdcClientManager manager = new IdcClientManager ();

            

                try

                {

                 

                                        IdcClient idcClient = manager.createClient ("idc://192.168.0.215:4448");

                  

                     IdcContext userContext = new IdcContext ("oudadmin");

                

                     HdaBinderSerializer serializer = new HdaBinderSerializer ("UTF-8", idcClient.getDataFactory ());

               

                  

                     DataBinder dataBinder = idcClient.createBinder();

                   System.out.println("inside dataBinder and above GET_FILE");

                    dataBinder.putLocal("IdcService", "GET_FILE");

                

                    System.out.println("after GET_FILE");

                    dataBinder.putLocal("dID","1804" );

                    dataBinder.putLocal("dDocName","WCC215.GENX.COM001804");

                    System.out.println("after did and ddocname");

                   //  dataBinder.putLocal("dDocName", "MYDOCNAME");

                    dataBinder.putLocal("allowInterrupt", "1");

                     serializer.serializeBinder(System.out, dataBinder);

                    FileOutputStream fos = new FileOutputStream("test.txt");

                       ServiceResponse response1 =

                       idcClient.sendRequest(userContext, dataBinder);

                    

                       InputStream fis = response1.getResponseStream();

                       ByteArrayOutputStream bos = null;

                    System.out.println("after bytearrayoutputstream assis");

                 

                       byte[] readData = new byte[1024];

                       int i = fis.read(readData);

                       while (i != -1) {

                         fos.write(readData, 0, i);

                         i = fis.read(readData);

                       }

                           System.out.println("after bos.write");

                           // Close the socket connection

                              response1.close();

                              // Don't leave the streams open

                              fos.close();

                              fis.close();

                      

                   

                }

                  

              

}

I   am calling this code from jsp page although the code is running successfully without any error but document is not getting download to the local system.

I don't why its not functioning as expected.

Regards.

Tagged:

Answers

  • ManojC
    ManojC Member Posts: 538
    edited Feb 7, 2019 9:40AM

    Can you try to run the code from your local IDE to make sure the document streaming is working fine. Also if you are passing the dID value as input then you don't have to pass dDocName as part of the binder. I can see you have modified the default idcclient port to 4448, so check you have the socket connection is working from your client to server.

  • 3698041
    3698041 Member Posts: 7
    edited Feb 7, 2019 9:58AM

    Hi ManojC,

    Thanks for the reply, the idc port is correct as the checkin part from ridc has been done from this port. aslo the document streaming is working fine.

    Thanks

  • ManojC
    ManojC Member Posts: 538
    edited Feb 8, 2019 9:55AM

    You need to enable some tracing in CS and monitor the activity. Also in the response object check the header values like (Content-Type, Content-Length) to see the file is part of the response or not.

    I don't see any other reason on why its failing to download the document after establishing the connection.