0 Replies Latest reply on Mar 2, 2015 9:43 AM by steven456

    Call service from java servlet failed

    steven456

      My goal is to call a service from a java servlet.

       

      Here is the code I wrote in my servlet,

       

                  try{
                           //Set connection properties required to invoke LiveCycle ES Properties
                                Properties connectionProps = new Properties();
                                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT,
                                     "t3://xxx.xxx.52.67:7001");
                                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,
                                     ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);    
                                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE,
                                     "WebLogic");
                                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME,
                                     "administrator");
                                connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD,
                                     "xxxxxxxx");
                                                    
                           //Create a ServiceClientFactory object
                           ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
                                                        
                           //Create a ServiceClient object
                           ServiceClient myServiceClient = myFactory.getServiceClient();
                          
                           //Create a Map object to store the parameter value
                           Map params = new HashMap();
                                                                 
                           //Create an InvocationRequest object
                           InvocationRequest esRequest =
                           myFactory.createInvocationRequest(
                           "http://xxx.xxx.52.67:9080/rest/services/AQUO_STEVEN/Processes/RenderEmployeePDF:1.0",
                           //Specify the LiveCycle ES process name
                                 "invoke",          //Specify the operation name
                                 params,                    //Specify input values
                                 true);                     //Create a synchronous request
                                                  
                           //Send the invocation request to the process and
                           //get back an invocation response object
                           InvocationResponse esResponse = myServiceClient.invoke(esRequest);
                           FormsResult formOut = (FormsResult)esResponse.getOutputParameter("RenderedForm");
                                            
                           //Create a Document object that stores form data
                           Document myData = formOut.getOutputContent();
                                      
                           //Get the content type of the response and
                           //set the HttpServletResponse object's content type
                           String contentType = myData.getContentType();
                          
                           resp.setContentType("text/html;charset=UTF-8");
                                      
                           //Create a ServletOutputStream object
                           ServletOutputStream oOutput = resp.getOutputStream();
                                      
                           //Create an InputStream object
                           InputStream inputStream = myData.getInputStream();
                                      
                           //Get the size of the InputStream object
                           int size = inputStream.available();
                                      
                           //Create and populate a byte array 
                           byte[] data = new byte[size];
                           inputStream.read(data);
                                                  
                           //Write the data stream to the web browser           
                           oOutput.write(data);
                                            
                            } catch (Exception e) {
                                 e.printStackTrace();
                           }            

       

      and

      AQUO_STEVEN/Processes/RenderEmployeePDF:1.0 is the process I created in Adobe Workbench.

       

      However, I get the following exception in the log file.

       

      ####<Mar 2, 2015 11:38:34 AM EST> <Notice> <StdErr>  <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1425314314630> <BEA-000000> <ALC-DSC-031-000: com.adobe.idp.dsc.net.DSCNamingException: Remote EJBObject lookup failed for ejb/Invocation provider>

      ####<Mar 2, 2015 11:38:34 AM EST> <Notice> <StdErr> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1425314314630> <BEA-000000> <at com.adobe.idp.dsc.provider.impl.ejb.EjbMessageDispatcher.initialise(EjbMessageDispatcher. java:101)>

      ####<Mar 2, 2015 11:38:34 AM EST> <Notice> <StdErr>  <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1425314314631> <BEA-000000> <at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke(ServiceClient.java:208)>

      ####<Mar 2, 2015 11:38:34 AM EST> <Notice> <StdErr> <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1425314314632> <BEA-000000> <at xxx.xxx.custom.webcomponents.NoRegHtmlRenderServlet.reply(NoRegHtmlRenderServlet.java:159 )>

      ####<Mar 2, 2015 11:38:34 AM EST> <Notice> <StdErr>  <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1425314314634> <BEA-000000> <at xxx.xxx.custom.webcomponents.NoRegHtmlRenderServlet.doPost(NoRegHtmlRenderServlet.java:73 )>

      ####<Mar 2, 2015 11:38:34 AM EST> <Notice> <StdErr>  <[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1425314314634> <BEA-000000> <at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)>

       

      where line 159 is this line,

       

      InvocationResponse esResponse = myServiceClient.invoke(esRequest);

       

      Can anyone give me some suggestions on how to fix this error?

       

      thanks

      Steven