Expand my Community achievements bar.

Soap, submit formdata

Avatar

Former Community Member

Hi everybody,

I'm trying to submit a task and the related data to ALC using Soap, from an external application, to implement HTML/Angular Forms in ALC ES3, but can not find any doc nor any info about what service to invoke...

I've tried to use ProcessManagementTaskService, which seems to be the one invoked when a Flex form is submitted in the workspace, but can not get it work (I get a nullpointerexception on backend side, which, after some decompiling, seems to be caused by a lack of flex session... see ProcessManagementTaskServiceImpl on line 1090, it invokes FlexContext.getHttpRequest, which I bet is null at this point (but that may be the session as well)).

See that decompiled code:


  private TaskItemResult callSubmitService(String taskId, int formIndex, com.adobe.idp.Document doc)


    throws ProcessManagementException


  {


    if (doc == null) {


      return null;


    }


    long start = ProcessManagementUtils.getCurrentTime();


    try


    {


      long tid = Long.parseLong(taskId);




      HttpServletRequest request = FlexContext.getHttpRequest();








      request.getSession().setAttribute("prepared_taskId", ""); // ******* line 1090 -> NPE




      Map inputMap = new HashMap();


      Map httpHeaders = new HashMap();






      String environmentBuffer = (String)doc.getAttribute("environment");


      String userAgent = (String)doc.getAttribute("userAgent");


      inputMap.put("targetUrl", getTargetUrl());


      inputMap.put("relativeTargetUrl", "/rest/services/ProcessManagementDocumentHandlingService.submit");


      inputMap.put("environmentBuffer", environmentBuffer);


      inputMap.put("userAgent", userAgent);


      inputMap.put("acrobatVersion", (String)request.getSession().getAttribute("acrobatVersion"));


      inputMap.put("acroClientType", (String)request.getSession().getAttribute("acroClientType"));


      inputMap.put("pm:callingApplication", "pm:workspace");




      Enumeration headerNames = request.getHeaderNames();


      while (headerNames.hasMoreElements()) {


        String headerName = (String)headerNames.nextElement();


        httpHeaders.put(headerName, request.getHeader(headerName));


      }




      httpHeaders.put("accept-language", (String)request.getSession().getAttribute("Accept-Language"));


      inputMap.put("httpHeaders", httpHeaders);




      TaskManager tm = TaskManagerClientFactory.getTaskManager(ProcessManagementUtils.getServiceClientFactory());




      FormServiceInvokeResponse response = null;


      long innerStart = ProcessManagementUtils.getCurrentTime();


      try


      {


        response = tm.callSubmitService(tid, 0L, doc, inputMap);


      }


      catch (TaskManagerException e) {


        String msg = ProcessManagementUtils.formatMessage("ALC-WKS-005-029", new Object[] { taskId });


        throw new ProcessManagementException(msg, e);


      }


      catch (RuntimeException e) {


        String msg = ProcessManagementUtils.formatMessage("ALC-WKS-005-029", new Object[] { taskId });


        throw new ProcessManagementException(msg, e);


      }




      ProcessManagementUtils.traceTime(this, timeLogger, "submit.tm.callSubmitService", innerStart, Level.FINER);




      TaskItemResult results = new TaskItemResult();


      populateTaskItemResult(results, response);


      FormInstance _formInstanceReturned = tm.getEmptyForm();




      _formInstanceReturned.setDocument(response.getResultingDocument());




      innerStart = ProcessManagementUtils.getCurrentTime();


      try


      {


        Object successSubmit = results.getMap().get("success");


        Object renderAgain = results.getMap().get("newRender");




        tm.setParticipantIPAddress(ProcessManagementUtils.getClientIPAddress(request));




        if ((successSubmit != null) && (renderAgain != null)) {


          if ((renderAgain.toString().compareTo("false") == 0) && (successSubmit.toString().compareTo("true") == 0)) {


            tm.save(tid, _formInstanceReturned);


          }


        }


        else


          tm.save(tid, _formInstanceReturned);


      }


      catch (TaskManagerException e) {


        String msg = ProcessManagementUtils.formatMessage("ALC-WKS-005-029", new Object[] { taskId });


        throw new ProcessManagementException(msg, e);


      }


      catch (RuntimeException e) {


        String msg = ProcessManagementUtils.formatMessage("ALC-WKS-005-029", new Object[] { taskId });


        throw new ProcessManagementException(msg, e);


      }


      finally


      {


        jsr 6; } ProcessManagementUtils.traceTime(this, timeLogger, "submit.tm.save", innerStart, Level.FINER); ret;






      return results;


    }


    finally


    {


      ProcessManagementUtils.traceTime(this, timeLogger, "submit", start, Level.FINER);


    }


  }


Then, I tried to invoke TaskManagerService, but I can't get it work too / doesn't seem to be the right service...

Can anybody shed some light on this?

Thanks you very much in advance!

0 Replies