Search in sources :

Example 1 with IDoc

use of com.sap.mw.idoc.IDoc 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);
        IDoc.Document idoc = parseIdoc(sapSystem, message);
        try {
            log.debug(getLogPrefix() + "checking syntax");
            idoc.checkSyntax();
        } catch (IDoc.Exception e) {
            throw new SenderException("Syntax error in idoc", e);
        }
        if (log.isDebugEnabled()) {
            log.debug(getLogPrefix() + "parsed idoc [" + idoc.toXML() + "]");
        }
        JCO.Client client = getClient(prc.getSession(), sapSystem);
        try {
            tid = getTid(client, sapSystem);
            if (tid == null) {
                throw new SenderException("could not obtain TID to send Idoc");
            }
            client.send(idoc, tid);
        } finally {
            releaseClient(client, sapSystem);
        }
        return tid;
    } catch (Exception e) {
        throw new SenderException(e);
    }
}
Also used : ParameterValueList(nl.nn.adapterframework.parameters.ParameterValueList) JCO(com.sap.mw.jco.JCO) SenderException(nl.nn.adapterframework.core.SenderException) IDoc(com.sap.mw.idoc.IDoc) SenderException(nl.nn.adapterframework.core.SenderException) TimeOutException(nl.nn.adapterframework.core.TimeOutException)

Aggregations

IDoc (com.sap.mw.idoc.IDoc)1 JCO (com.sap.mw.jco.JCO)1 SenderException (nl.nn.adapterframework.core.SenderException)1 TimeOutException (nl.nn.adapterframework.core.TimeOutException)1 ParameterValueList (nl.nn.adapterframework.parameters.ParameterValueList)1