use of com.sap.conn.idoc.IDocDocument 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());
}
}
}
use of com.sap.conn.idoc.IDocDocument 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);
}
}
Aggregations