Search in sources :

Example 1 with IDocException

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

the class IdocSender method sendMessage.

public String sendMessage(String correlationID, String message, ParameterResolutionContext prc) throws SenderException, TimeOutException {
    String tid = null;
    try {
        ParameterValueList pvl = null;
        if (prc != null) {
            pvl = prc.getValues(paramList);
        }
        SapSystem sapSystem = getSystem(pvl);
        IDocDocument idoc = parseIdoc(sapSystem, message);
        try {
            log.debug(getLogPrefix() + "checking syntax");
            idoc.checkSyntax();
        } catch (IDocException e) {
            throw new SenderException("Syntax error in idoc", e);
        }
        if (log.isDebugEnabled()) {
            log.debug(getLogPrefix() + "parsed idoc [" + JCoIDoc.getIDocFactory().getIDocXMLProcessor().render(idoc) + "]");
        }
        JCoDestination destination = getDestination(prc.getSession(), sapSystem);
        tid = getTid(destination, sapSystem);
        if (tid == null) {
            throw new SenderException("could not obtain TID to send Idoc");
        }
        JCoIDoc.send(idoc, IDocFactory.IDOC_VERSION_DEFAULT, destination, tid);
        return tid;
    } catch (Exception e) {
        throw new SenderException(e);
    }
}
Also used : ParameterValueList(nl.nn.adapterframework.parameters.ParameterValueList) JCoDestination(com.sap.conn.jco.JCoDestination) IDocDocument(com.sap.conn.idoc.IDocDocument) SenderException(nl.nn.adapterframework.core.SenderException) IDocException(com.sap.conn.idoc.IDocException) IDocException(com.sap.conn.idoc.IDocException) SenderException(nl.nn.adapterframework.core.SenderException) TimeOutException(nl.nn.adapterframework.core.TimeOutException)

Example 2 with IDocException

use of com.sap.conn.idoc.IDocException in project Tundra by Permafrost.

the class idoc method partition.

public static final void partition(IData pipeline) throws ServiceException {
    // --- <<IS-START(partition)>> ---
    // @subtype unknown
    // @sigtype java 3.5
    // [i] object:0:optional $idoclist
    // [i] field:0:optional $limit
    // [o] object:1:optional $idoclists
    IDataCursor cursor = pipeline.getCursor();
    try {
        IDocDocumentList list = IDataHelper.get(cursor, "$idoclist", IDocDocumentList.class);
        int limit = IDataHelper.getOrDefault(cursor, "$limit", Integer.class, 0);
        IDocDocumentList[] table = IDocDocumentListHelper.partition(list, limit);
        IDataHelper.put(cursor, "$idoclists", table, false);
        IDataHelper.put(cursor, "$idoclists.length", table == null ? 0 : table.length, String.class);
    } catch (IDocException ex) {
        ExceptionHelper.raise(ex);
    } finally {
        cursor.destroy();
    }
// --- <<IS-END>> ---
}
Also used : IDocDocumentList(com.sap.conn.idoc.IDocDocumentList) IDocException(com.sap.conn.idoc.IDocException)

Example 3 with IDocException

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

the class IdocSender method sendMessage.

@Override
public Message sendMessage(Message message, PipeLineSession session) throws SenderException, TimeoutException {
    String tid = null;
    try {
        ParameterValueList pvl = null;
        if (paramList != null) {
            pvl = paramList.getValues(message, session);
        }
        SapSystem sapSystem = getSystem(pvl);
        IDocDocument idoc = parseIdoc(sapSystem, message);
        try {
            log.trace(getLogPrefix() + "checking syntax");
            idoc.checkSyntax();
        } catch (IDocException e) {
            throw new SenderException("Syntax error in idoc", e);
        }
        if (log.isDebugEnabled()) {
            log.debug(getLogPrefix() + "parsed idoc [" + JCoIDoc.getIDocFactory().getIDocXMLProcessor().render(idoc) + "]");
        }
        JCoDestination destination = getDestination(session, sapSystem);
        tid = getTid(destination, sapSystem);
        if (tid == null) {
            throw new SenderException("could not obtain TID to send Idoc");
        }
        JCoIDoc.send(idoc, IDocFactory.IDOC_VERSION_DEFAULT, destination, tid);
        return new Message(tid);
    } catch (Exception e) {
        throw new SenderException(e);
    }
}
Also used : ParameterValueList(nl.nn.adapterframework.parameters.ParameterValueList) Message(nl.nn.adapterframework.stream.Message) JCoDestination(com.sap.conn.jco.JCoDestination) IDocDocument(com.sap.conn.idoc.IDocDocument) SenderException(nl.nn.adapterframework.core.SenderException) IDocException(com.sap.conn.idoc.IDocException) IDocException(com.sap.conn.idoc.IDocException) SenderException(nl.nn.adapterframework.core.SenderException) TimeoutException(nl.nn.adapterframework.core.TimeoutException)

Aggregations

IDocException (com.sap.conn.idoc.IDocException)3 IDocDocument (com.sap.conn.idoc.IDocDocument)2 JCoDestination (com.sap.conn.jco.JCoDestination)2 SenderException (nl.nn.adapterframework.core.SenderException)2 ParameterValueList (nl.nn.adapterframework.parameters.ParameterValueList)2 IDocDocumentList (com.sap.conn.idoc.IDocDocumentList)1 TimeOutException (nl.nn.adapterframework.core.TimeOutException)1 TimeoutException (nl.nn.adapterframework.core.TimeoutException)1 Message (nl.nn.adapterframework.stream.Message)1