code: protected DocumentReference createDocument(String docType, Object document,
              String ownerType, Long ownerId, Long processInstanceId, String searchKey1, String searchKey2)
      throws EventHandlerException {
          ListenerHelper helper = new ListenerHelper();
          return helper.createDocument(docType, document, getPackage(), ownerType, ownerId);
      }
docs: This method is used to create a document from external messages. The document reference
  returned can be sent as parameters to start or inform processes.
  
  @param docType this should be variable type if the document reference is to be bound
  to variables.
  @param document The document object itself, such as an XML bean document (subclass of XmlObject)
  @param ownerType this should be OwnerType.LISTENER_REQUEST if the message
  is received from external system and OwnerType.LISTENER_RESPONSE
  if the message is to be sent as response back to the external systems.
  Application-created documents can be set to other types.
  @param ownerId It is set to
  event handler ID for LISTENER_REQUEST and the request document ID for LISTENER_RESPONSE.
  For application's usage, you should set the ID corresponding to the owner type.
  @param processInstanceId this is the ID of the process instance the message is going to
  be delivered to. If that information is not available, pass new Long(0) to it.
  You can update the information using updateDocumentInfo later on.
  @param searchKey1 user defined search key. Pass null if you do not need custom search key
  @param searchKey2 another custom search key. Pass null if you do not need it.
  @return document reference that refers to the newly created document.
  @throws EventHandlerException