Resubmitting Imaging Documents to SOA Workflow

Summary:

Every WCI admin will eventually be faced with the issue of “how can documents be resubmitted to a workflow?”

By default, if a document workflow connection exists, the imaging application will automatically attempt to reinject the document into the workflow. In scenarios where things such as the SOA instance being down or another error causes workflow injection failure, the reinjection attempt will fail.

When an error occurs, the Document ID is written to the BPEL_FAULT_DATA table in the imaging schema. Take note that this table only contains errors related to document injection into workflow and does not track errors the occur with the BPEL process itself. The BPEL_FAULT_DATA table only tracks issues where imaging could not initiate the workflow.

Multiple approaches for resubmitting documents are discussed below—

WLST:

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 for to workflow.

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

  • 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.

An additional MBean that can be useful for resubmitting individual documents that need 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.

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.

Web Services:

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.

WSDL path: 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>

Java:

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();       }    } }

Is your organization in need of help supporting your existing WebCenter environment? Contact Inspired ECM to learn about our managed support offerings, or how we can procure full-time talent.