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