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