Search in sources :

Example 1 with IDocDocumentIterator

use of com.sap.conn.idoc.IDocDocumentIterator in project iaf by ibissource.

the class SapListener method handleRequest.

public void handleRequest(JCoServerContext serverCtx, IDocDocumentList documentList) {
    log.debug(getLogPrefix() + "Incoming IDoc list request containing " + documentList.getNumDocuments() + " documents...");
    IDocXMLProcessor xmlProcessor = JCoIDoc.getIDocFactory().getIDocXMLProcessor();
    IDocDocumentIterator iterator = documentList.iterator();
    IDocDocument doc = null;
    while (iterator.hasNext()) {
        doc = iterator.next();
        log.debug(getLogPrefix() + "Processing document no. [" + doc.getIDocNumber() + "] of type [" + doc.getIDocType() + "]");
        try {
            handler.processRequest(this, xmlProcessor.render(doc));
        } catch (Throwable t) {
            log.warn(getLogPrefix() + "Exception caught and handed to SAP", t);
            throw new JCoRuntimeException(JCoException.JCO_ERROR_APPLICATION_EXCEPTION, "IbisException", t.getMessage());
        }
    }
}
Also used : IDocDocumentIterator(com.sap.conn.idoc.IDocDocumentIterator) IDocDocument(com.sap.conn.idoc.IDocDocument) JCoRuntimeException(com.sap.conn.jco.JCoRuntimeException) IDocXMLProcessor(com.sap.conn.idoc.IDocXMLProcessor)

Aggregations

IDocDocument (com.sap.conn.idoc.IDocDocument)1 IDocDocumentIterator (com.sap.conn.idoc.IDocDocumentIterator)1 IDocXMLProcessor (com.sap.conn.idoc.IDocXMLProcessor)1 JCoRuntimeException (com.sap.conn.jco.JCoRuntimeException)1