Methods for Resubmitting Imaging Documents to SOA Workflow

When a document is created or uploaded in WebCenter Imaging, if a workflow connection exists the Imaging managed server automatically attempts to inject the document into workflow. However, in scenarios where either the SOA instance is down or another error causes a workflow injection failure, the workflow never gets started. If an error occurs, the document id is written to the BPEL_FAULT_DATA table in the Imaging schema (e.g. DEV_IPM).  It’s worth noting up front that this table only contains errors related to the injection of the document into workflow, but does not track faults that occur with the BPEL process itself. The BPEL_FAULT_DATA table only tracks issues where Imaging could not initiate the workflow.

fault-data

The question most Imaging admins arrive at sooner or later is “how can a document be resubmitted to workflow?” There are a few different ways to resolve these issues where the document never entered workflow, or the document did enter workflow but for some reason needs to re-start the workflow process.

Several MBeans can be used in Enterprise Manager under the Application Defined MBeans for oracle.imaging. Under the server name, the cmd MBeans contain operations that can list the data from the BPEL_FAULT_DATA table and repair the failures by retrying those. In addition, another MBean can clear the fault data once all desired documents have been resubmitted to workflow.

The MBeans useful for viewing, resubmitting, and clearing workflow faults are accessible using WLST as well, with full examples and documentation on how to execute at this link.

  • clearIPMWorkflowFaults - Clear processing failures that occurred during workflow agent processing.
  • listIPMWorkflowFaults - Provide details of processing failures that occurred during workflow agent processing.
  • repairIPMWorkflowFaults - Repair processing failures that occurred during workflow agent processing.
  • sumIPMWorkflowFaults - Count processing failures during workflow agent processing, grouped by choice of date, application ID, or batch ID.

There is an additional MBean that can be very useful for resubmitting individual Imaging documents that has identified as needing to re-enter workflow.

submitIPMToWorkflow – Submits a document to the workflow agent. Note that a confirmation message is displayed stating that the document has been submitted, however if the document is stored in an application that is not configured with a workflow, no action is taken.

mbeans

 

In some cases the “repairIPMWorkflowFaults” may be needed to clean up failed resubmissions. After this is invoked, the listIPMWorkflowFaults can be used once again to see if any of the documents have failed a second time. When all of the failed documents are resubmitted, the clearIPMWorkflowFaults can be used.

In other situations, the submitIPMToWorkflow task can be invoked for individual documents, or it can be scripted for a list of documents if using WLST. This can be a powerful tool where a batch or selection of Imaging documents failed to enter workflow or hit a non-recoverable fault within a BPEL process.

submittoworkflow

 

For some admins, the use of MBeans and WLST is not the preferred approach. Imaging also provides Java and Web Service methods for resubmitting to workflow. The “DocumentService” web service has an operation called submitToWorkflow that allows for the same behavior as the MBean. The WSDL path is shown below:

http://myimaginghost:16000/imaging/ws/DocumentService?wsdl

A quick test with SoapUI can list all of the capabilities of the DocumentService WSDL, with submitToWorkflow being one of many. A sample SOAP request is shown below for resubmitting a single Imaging document to SOA for workflow injection. The only parameter needed in the request is the document id, such as 3.IPM_057805.

 

<soapenv:Envelope xmlns:imag="http://imaging.oracle/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsse:UsernameToken wsu:Id="UsernameToken-1">
            <wsse:Username>weblogic</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">welcome1</wsse:Password>
            <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">H2eFojfVXWdW2n4k8PJbjg==</wsse:Nonce>
            <wsu:Created>2014-03-18T19:39:41.638Z</wsu:Created>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <imag:submitToWorkflow>

         <documentId>3.IPM_057805</documentId>
      </imag:submitToWorkflow>
   </soapenv:Body>
</soapenv:Envelope>

soapui

 

In addition to Web Service calls, Java can be used to resubmit documents to workflow. The DocumentService class allows for the same operation using the following method:

docService.submitToWorkflow("3.IPM_057805");

A basic sample class file below shows how to use the DocumentService to update to an application field and then resubmit an Image to workflow.

package devguidesamples;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import oracle.imaging.BasicUserToken;
import oracle.imaging.Document;
import oracle.imaging.DocumentContentService;
import oracle.imaging.DocumentService;
import oracle.imaging.ImagingException;
import oracle.imaging.ServicesFactory;
import oracle.imaging.UserToken;

public class ResubmitToWorkflow {
   public static void main(String[] args)
      throws IOException {
      try { // try-catch
         UserToken credentials = new BasicUserToken("weblogic", "welcome1");
         ServicesFactory servicesFactory =
            ServicesFactory.login(credentials, Locale.US, "http://myimaginghost:16000/imaging/ws");

         try { // try-finally to ensure logout

            DocumentService docService = servicesFactory.getDocumentService();
            DocumentContentService docContentService = 
                   servicesFactory.getDocumentContentService();

            String documentID = "3.IPM_057809";

            // update field value before resubmit.
            List<Document.FieldValue> fieldValues = new ArrayList<Document.FieldValue>();
            fieldValues.add(new Document.FieldValue("Organization", new String("Vision Operations")));
            docService.updateDocument(documentID, null, fieldValues, false);   

            <strong>docService.submitToWorkflow(documentID);</strong>
         }
         finally {
            if (servicesFactory != null) {
               servicesFactory.logout();
            }
         }
      }
      catch (ImagingException e) {
         System.out.println(e.getMessage());
         e.printStackTrace();
      }
   }
}

Add Your Comment