From 8c3a762c0eaa9629fc38bb3fc508e91dceb6bbde Mon Sep 17 00:00:00 2001 From: "David E. Jones" Date: Mon, 13 Aug 2007 23:50:59 +0000 Subject: [PATCH] Changed the error message handling for incoming messages and sending outgoing CBOD messages; also cleaned up the services.xml file to eliminate unused service defs and organize the services better git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@565576 13f79535-47bb-0310-9956-ffa450edef68 --- oagis/config/oagis.properties | 22 +-- oagis/servicedef/secas.xml | 11 +- oagis/servicedef/services.xml | 118 +++++--------- .../ofbiz/oagis/OagisInventoryServices.java | 153 ++++++++++++++---- oagis/src/org/ofbiz/oagis/OagisServices.java | 62 +++++-- .../ofbiz/oagis/OagisShipmentServices.java | 57 ++++--- 6 files changed, 261 insertions(+), 162 deletions(-) diff --git a/oagis/config/oagis.properties b/oagis/config/oagis.properties index 0ebd23796..c7604c965 100644 --- a/oagis/config/oagis.properties +++ b/oagis/config/oagis.properties @@ -18,10 +18,10 @@ ############################################################################### # -- logical location of server (10 char max) -CNTROLAREA.SENDER.LOGICALID=1234567890 +CNTROLAREA.SENDER.LOGICALID=792024833 # -- auth id is required to access machine that generated the BOD (50 char max) -CNTROLAREA.SENDER.AUTHID=Ofbiz +CNTROLAREA.SENDER.AUTHID=VUDU # if these are set to true the XML content of the messages will be saved to OagisMessageInfo.fullMessageXml Oagis.Debug.Save.Xml.Out=true @@ -40,18 +40,22 @@ Oagis.Warehouse.SyncInventoryFacilityId=WebStoreWarehouse Oagis.Warehouse.SyncInventoryProductStoreId=9001 # email notification -#oagis.notification.email.sendTo=foo@bar.org +oagis.notification.email.sendTo=jonesde@hotwaxmedia.com # Client Cert, etc settings #auth.client.certificate.alias=testrpckey -#auth.basic.username=foo -#auth.basic.password=bar +auth.basic.username=792024833 +auth.basic.password=aZ79202uS # URLs for outgoing messages -#url.send.processShipment=https://foo.bar.baz/oagis/control/processShipment -#url.send.confirmBod=https://foo.bar.baz/oagis/control/confirmBod -#url.send.receiveDelivery=https://foo.bar.baz/oagis/control/receiveDelivery +#url.send.processShipment=https://b2b.avnet.com:5361/invoke/wm.tn/receive +#url.send.confirmBod=https://b2b.avnet.com:5361/invoke/wm.tn/receive +#url.send.receiveDelivery=https://b2b.avnet.com:5361/invoke/wm.tn/receive +# test URLs +url.send.processShipment=https://b2b-test.avnet.com:5361/invoke/wm.tn/receive +url.send.confirmBod=https://b2b-test.avnet.com:5361/invoke/wm.tn/receive +url.send.receiveDelivery=https://b2b-test.avnet.com:5361/invoke/wm.tn/receive # if the test.save.outgoing.directory is specified the files will be saved there but not sent to any URL that might be specified -test.save.outgoing.directory=. +test.save.outgoing.directory=/Users/jonesde test.save.outgoing.filename.base=Test diff --git a/oagis/servicedef/secas.xml b/oagis/servicedef/secas.xml index 6bc214406..2ade50411 100644 --- a/oagis/servicedef/secas.xml +++ b/oagis/servicedef/secas.xml @@ -20,15 +20,13 @@ under the License. - - - - - - - - - diff --git a/oagis/servicedef/services.xml b/oagis/servicedef/services.xml index fce6edd1e..5a3d480af 100644 --- a/oagis/servicedef/services.xml +++ b/oagis/servicedef/services.xml @@ -20,48 +20,28 @@ under the License. - - - - - - - - - - - - - - - - - - - - - + + + - + Create MessageInfo - Update MessageInfo - Create MessageErrorInfo @@ -69,7 +49,6 @@ under the License. - Update MessageErrorInfo @@ -77,22 +56,21 @@ under the License. - Create MessageErrorInfo From Error Map List - + - - - - Process incoming shipment message - - + + + + + Send ConfirmBod @@ -107,18 +85,10 @@ under the License. - Process incoming ConfirmBod - - - - - - Process incoming Inventory Sync message - + @@ -130,12 +100,13 @@ under the License. + + Prepare and Optionally Send OAGIS Process Shipment Message. Note on usage: you can pass in either sendToUrl, saveToFilename, or outputStream. If none are passed in the URL in oagis.properties will be used at the target for the message. - @@ -143,16 +114,6 @@ under the License. - - Send Process Shipment Message - - - - - - - Receive Delivery @@ -163,28 +124,35 @@ under the License. - - Process PO Acknowledge message - + + + + Process incoming Inventory Sync message + - - - Process RMA Acknowledge message - - - - - - - - - - - + + + Process incoming shipment message + + + + + + Process PO Acknowledge message + + + + + + Process RMA Acknowledge message + + + + diff --git a/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java b/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java index 20b1f089c..5e35a29dd 100644 --- a/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java +++ b/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java @@ -98,7 +98,7 @@ public class OagisInventoryServices { String authId = UtilXml.childElementValue(docSenderElement, "of:AUTHID"); // create oagis message info - Map comiCtx= FastMap.newInstance(); + Map comiCtx = FastMap.newInstance(); comiCtx.put("logicalId", logicalId); comiCtx.put("component", component); comiCtx.put("task", task); @@ -294,14 +294,6 @@ public class OagisInventoryServices { } } - comiCtx.put("processingStatusId", "OAGMP_PROC_SUCCESS"); - try { - dispatcher.runSync("updateOagisMessageInfo", comiCtx, 60, true); - } catch (GenericServiceException e) { - String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); - Debug.logError(e, errMsg, module); - } - Map result = FastMap.newInstance(); result.put("logicalId", logicalId); result.put("component", component); @@ -309,14 +301,49 @@ public class OagisInventoryServices { result.put("referenceId", referenceId); result.put("userLogin", userLogin); - // check error list if there is any if (errorMapList.size() > 0) { - result.put("errorMapList", errorMapList); - String errMsg = "Error Processing Received Messages"; - result.putAll(ServiceUtil.returnError(errMsg)); + // call services createOagisMsgErrInfosFromErrMapList and for incoming messages oagisSendConfirmBod + Map saveErrorMapListCtx = FastMap.newInstance(); + saveErrorMapListCtx.put("logicalId", logicalId); + saveErrorMapListCtx.put("component", component); + saveErrorMapListCtx.put("task", task); + saveErrorMapListCtx.put("referenceId", referenceId); + saveErrorMapListCtx.put("errorMapList", errorMapList); + try { + dispatcher.runSync("createOagisMsgErrInfosFromErrMapList", saveErrorMapListCtx, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + Debug.logError(e, errMsg, module); + } + + try { + Map sendConfirmBodCtx = FastMap.newInstance(); + sendConfirmBodCtx.putAll(saveErrorMapListCtx); + // NOTE: this is different for each service, should be shipmentId or returnId or PO orderId or etc + // for sync inventory no such ID: sendConfirmBodCtx.put("origRefId", shipmentId); + + // run async because this will send a message back to the other server and may take some time, and/or fail + dispatcher.runAsync("oagisSendConfirmBod", sendConfirmBodCtx, null, true, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + Debug.logError(e, errMsg, module); + } + + // DEJ20070807 what was this next line commented out? if there are errors we want to return an error so this will roll back + result.putAll(ServiceUtil.returnError("Errors found processing message; information saved and return error sent back")); return result; + } else { + comiCtx.put("processingStatusId", "OAGMP_PROC_SUCCESS"); + try { + dispatcher.runSync("updateOagisMessageInfo", comiCtx, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + // don't pass this back, nothing they can do about it: errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException")); + Debug.logError(e, errMsg, module); + } } - result.putAll(ServiceUtil.returnSuccess("Action Performed Successfully")); + + result.putAll(ServiceUtil.returnSuccess("Service Completed Successfully")); return result; } @@ -393,6 +420,7 @@ public class OagisInventoryServices { String facilityId = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Warehouse.PoReceiptFacilityId"); String productId = null; + String orderId = null; // get RECEIPTLN elements from message List acknowledgeElementList = UtilXml.childElementList(acknowledgeDeliveryElement, "ns:RECEIPTLN"); if (UtilValidate.isNotEmpty(acknowledgeElementList)) { @@ -409,7 +437,7 @@ public class OagisInventoryServices { productId = UtilXml.childElementValue(receiptLnElement, "of:ITEM"); Element documentRefElement = UtilXml.firstChildElement(receiptLnElement, "os:DOCUMNTREF"); - String orderId = UtilXml.childElementValue(documentRefElement, "of:DOCUMENTID"); + orderId = UtilXml.childElementValue(documentRefElement, "of:DOCUMENTID"); String orderTypeId = UtilXml.childElementValue(documentRefElement, "of:DOCTYPE"); if(orderTypeId.equals("PO")) { orderTypeId = "PURCHASE_ORDER"; @@ -420,7 +448,7 @@ public class OagisInventoryServices { ripCtx.put("datetimeReceived", timestampItemReceived); // Check reference to PO number, if exists GenericValue orderHeader = null; - if(orderId != null) { + if (orderId != null) { try { List toStore = FastList.newInstance(); orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); @@ -487,14 +515,6 @@ public class OagisInventoryServices { } } } - - comiCtx.put("processingStatusId", "OAGMP_PROC_SUCCESS"); - try { - dispatcher.runSync("updateOagisMessageInfo", comiCtx, 60, true); - } catch (GenericServiceException e) { - String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); - Debug.logError(e, errMsg, module); - } Map result = FastMap.newInstance(); result.put("logicalId", logicalId); @@ -502,14 +522,50 @@ public class OagisInventoryServices { result.put("task", task); result.put("referenceId", referenceId); result.put("userLogin", userLogin); - + if (errorMapList.size() > 0) { - result.put("errorMapList", errorMapList); - String errMsg = "Error Processing Received Messages"; - result.putAll(ServiceUtil.returnError(errMsg)); + // call services createOagisMsgErrInfosFromErrMapList and for incoming messages oagisSendConfirmBod + Map saveErrorMapListCtx = FastMap.newInstance(); + saveErrorMapListCtx.put("logicalId", logicalId); + saveErrorMapListCtx.put("component", component); + saveErrorMapListCtx.put("task", task); + saveErrorMapListCtx.put("referenceId", referenceId); + saveErrorMapListCtx.put("errorMapList", errorMapList); + try { + dispatcher.runSync("createOagisMsgErrInfosFromErrMapList", saveErrorMapListCtx, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + Debug.logError(e, errMsg, module); + } + + try { + Map sendConfirmBodCtx = FastMap.newInstance(); + sendConfirmBodCtx.putAll(saveErrorMapListCtx); + // NOTE: this is different for each service, should be shipmentId or returnId or PO orderId or etc + sendConfirmBodCtx.put("origRefId", orderId); + + // run async because this will send a message back to the other server and may take some time, and/or fail + dispatcher.runAsync("oagisSendConfirmBod", sendConfirmBodCtx, null, true, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + Debug.logError(e, errMsg, module); + } + + // DEJ20070807 what was this next line commented out? if there are errors we want to return an error so this will roll back + result.putAll(ServiceUtil.returnError("Errors found processing message; information saved and return error sent back")); return result; + } else { + comiCtx.put("processingStatusId", "OAGMP_PROC_SUCCESS"); + try { + dispatcher.runSync("updateOagisMessageInfo", comiCtx, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + // don't pass this back, nothing they can do about it: errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException")); + Debug.logError(e, errMsg, module); + } } - result.putAll(ServiceUtil.returnSuccess("Action Performed Successfully")); + + result.putAll(ServiceUtil.returnSuccess("Service Completed Successfully")); return result; } @@ -604,7 +660,7 @@ public class OagisInventoryServices { String sign = UtilXml.childElementValue(qtyElement, "of:SIGN"); String productId = UtilXml.childElementValue(receiptLnElement, "of:ITEM"); - if ( productId == null ) { + if (productId == null) { String errMsg = "productId not available in Message" ; errorMapList.add(UtilMisc.toMap("reasonCode", "ParseException", "description", errMsg)); Debug.logError(errMsg, module); @@ -793,23 +849,50 @@ public class OagisInventoryServices { result.put("task", task); result.put("referenceId", referenceId); result.put("userLogin", userLogin); + if (errorMapList.size() > 0) { - result.put("errorMapList", errorMapList); - String errMsg = "Error Processing Received Messages"; - result.putAll(ServiceUtil.returnError(errMsg)); + // call services createOagisMsgErrInfosFromErrMapList and for incoming messages oagisSendConfirmBod + Map saveErrorMapListCtx = FastMap.newInstance(); + saveErrorMapListCtx.put("logicalId", logicalId); + saveErrorMapListCtx.put("component", component); + saveErrorMapListCtx.put("task", task); + saveErrorMapListCtx.put("referenceId", referenceId); + saveErrorMapListCtx.put("errorMapList", errorMapList); + try { + dispatcher.runSync("createOagisMsgErrInfosFromErrMapList", saveErrorMapListCtx, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + Debug.logError(e, errMsg, module); + } + + try { + Map sendConfirmBodCtx = FastMap.newInstance(); + sendConfirmBodCtx.putAll(saveErrorMapListCtx); + // NOTE: this is different for each service, should be shipmentId or returnId or PO orderId or etc + sendConfirmBodCtx.put("origRefId", returnId); + + // run async because this will send a message back to the other server and may take some time, and/or fail + dispatcher.runAsync("oagisSendConfirmBod", sendConfirmBodCtx, null, true, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + Debug.logError(e, errMsg, module); + } + + // DEJ20070807 what was this next line commented out? if there are errors we want to return an error so this will roll back + result.putAll(ServiceUtil.returnError("Errors found processing message; information saved and return error sent back")); return result; } else { - comiCtx.put("returnId", returnId); comiCtx.put("processingStatusId", "OAGMP_PROC_SUCCESS"); try { dispatcher.runSync("updateOagisMessageInfo", comiCtx, 60, true); } catch (GenericServiceException e){ String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + // don't pass this back, nothing they can do about it: errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException")); Debug.logError(e, errMsg, module); } } - result.putAll(ServiceUtil.returnSuccess("Action Performed Successfully")); + result.putAll(ServiceUtil.returnSuccess("Service Completed Successfully")); result.put("inventoryItemIdList", invItemIds); return result; } diff --git a/oagis/src/org/ofbiz/oagis/OagisServices.java b/oagis/src/org/ofbiz/oagis/OagisServices.java index 507d0b5c5..24fe6fc68 100644 --- a/oagis/src/org/ofbiz/oagis/OagisServices.java +++ b/oagis/src/org/ofbiz/oagis/OagisServices.java @@ -351,20 +351,49 @@ public class OagisServices { result.put("task", task); result.put("referenceId", referenceId); result.put("userLogin", userLogin); - + if (errorMapList.size() > 0) { - String errMsg = "Error Processing Received Message"; - result.put("errorMapList", errorMapList); - //result.putAll(ServiceUtil.returnError(errMsg)); + // call services createOagisMsgErrInfosFromErrMapList and for incoming messages oagisSendConfirmBod + Map saveErrorMapListCtx = FastMap.newInstance(); + saveErrorMapListCtx.put("logicalId", logicalId); + saveErrorMapListCtx.put("component", component); + saveErrorMapListCtx.put("task", task); + saveErrorMapListCtx.put("referenceId", referenceId); + saveErrorMapListCtx.put("errorMapList", errorMapList); + try { + dispatcher.runSync("createOagisMsgErrInfosFromErrMapList", saveErrorMapListCtx, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + Debug.logError(e, errMsg, module); + } + + + // TODO and NOTE DEJ20070813: should we really send back a Confirm BOD if there is an error with the Confirm BOD they send us? probably so... will do for now... + try { + Map sendConfirmBodCtx = FastMap.newInstance(); + sendConfirmBodCtx.putAll(saveErrorMapListCtx); + // NOTE: this is different for each service, should be shipmentId or returnId or PO orderId or etc + // no such thing for confirm bod: sendConfirmBodCtx.put("origRefId", shipmentId); + + // run async because this will send a message back to the other server and may take some time, and/or fail + dispatcher.runAsync("oagisSendConfirmBod", sendConfirmBodCtx, null, true, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + Debug.logError(e, errMsg, module); + } + + // DEJ20070807 what was this next line commented out? if there are errors we want to return an error so this will roll back + result.putAll(ServiceUtil.returnError("Errors found processing message; information saved and return error sent back")); return result; - } - - oagisMsgInfoCtx.put("processingStatusId", "OAGMP_PROC_SUCCESS"); - try { - dispatcher.runSync("updateOagisMessageInfo", oagisMsgInfoCtx, 60, true); - } catch (GenericServiceException e){ - String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); - Debug.logError(e, errMsg, module); + } else { + oagisMsgInfoCtx.put("processingStatusId", "OAGMP_PROC_SUCCESS"); + try { + dispatcher.runSync("updateOagisMessageInfo", oagisMsgInfoCtx, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + // don't pass this back, nothing they can do about it: errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException")); + Debug.logError(e, errMsg, module); + } } result.putAll(ServiceUtil.returnSuccess("Service Completed Successfully")); @@ -437,11 +466,12 @@ public class OagisServices { Debug.logError(e, errMsg, module); } - Map subServiceResult = FastMap.newInstance(); + // call async, no additional results to return: Map subServiceResult = FastMap.newInstance(); if (UtilValidate.isEmpty(oagisMessageInfo)) { if (bsrVerb.equalsIgnoreCase("CONFIRM") && bsrNoun.equalsIgnoreCase("BOD")) { try { - subServiceResult = dispatcher.runSync("receiveConfirmBod", UtilMisc.toMap("document", doc)); + // subServiceResult = dispatcher.runSync("receiveConfirmBod", UtilMisc.toMap("document", doc)); + dispatcher.runAsync("receiveConfirmBod", UtilMisc.toMap("document", doc), true); } catch (GenericServiceException e) { String errMsg = "Error running service receiveConfirmBod: " + e.toString(); errorList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "GenericServiceException")); @@ -506,9 +536,10 @@ public class OagisServices { } Map result = ServiceUtil.returnSuccess(); - result.putAll(subServiceResult); result.put("contentType", "text/plain"); + /* no sub-service error processing to be done here, all handled in the sub-services: + result.putAll(subServiceResult); List errorMapList = (List) subServiceResult.get("errorMapList"); if (UtilValidate.isNotEmpty(errorList)) { Iterator errListItr = errorList.iterator(); @@ -518,6 +549,7 @@ public class OagisServices { } result.put("errorMapList", errorMapList); } + */ return result; } diff --git a/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java b/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java index ce95c3d9b..21bdb184d 100644 --- a/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java +++ b/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java @@ -122,13 +122,6 @@ public class OagisShipmentServices { Element shipmentElement = UtilXml.firstChildElement(daShowShipmentElement, "ns:SHIPMENT"); // n String shipmentId = UtilXml.childElementValue(shipmentElement, "of:DOCUMENTID"); // of - Map result = FastMap.newInstance(); - result.put("logicalId", logicalId); - result.put("component", component); - result.put("task", task); - result.put("referenceId", referenceId); - result.put("userLogin", userLogin); - oagisMsgInfoCtx.put("logicalId", logicalId); oagisMsgInfoCtx.put("component", component); oagisMsgInfoCtx.put("task", task); @@ -180,17 +173,11 @@ public class OagisShipmentServices { errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "ShipmentIdNotValid")); } - if (errorMapList.size() > 0) { - result.putAll(ServiceUtil.returnError("Errors found getting shipment information for incoming Show Shipment message; here is the first: " + errorMapList.get(0))); - result.put("errorMapList", errorMapList); - return result; - } - String shipGroupSeqId = shipment.getString("primaryShipGroupSeqId"); String originFacilityId = shipment.getString("originFacilityId"); List shipUnitElementList = UtilXml.childElementList(daShowShipmentElement, "ns:SHIPUNIT"); // n - if(UtilValidate.isNotEmpty(shipUnitElementList)) { + if(errorMapList.size() == 0 && UtilValidate.isNotEmpty(shipUnitElementList)) { Element shipUnitElement = (Element)shipUnitElementList.get(0); String trackingNum = UtilXml.childElementValue(shipUnitElement, "of:TRACKINGID"); // of String carrierCode = UtilXml.childElementValue(shipUnitElement, "of:CARRIER"); // of @@ -257,7 +244,7 @@ public class OagisShipmentServices { requireInventory = "N"; } - // TODO and NOTE: could there be more than one reservation record for a given shipment item? for example if there wasn't enough quantity in one inventory item and reservations on two were needed? yes + // NOTE: there could be more than one reservation record for a given shipment item? for example if there wasn't enough quantity in one inventory item and reservations on two were needed List orderItemShipGrpInvReservationList = delegator.findByAnd("OrderItemShipGrpInvRes", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId,"shipGroupSeqId",shipGroupSeqId)); // find the total quantity for all reservations @@ -298,6 +285,8 @@ public class OagisShipmentServices { continueLoop = true; } + // TODO: if serialNumber does not exist in database add an error message + if (continueLoop) { continue; } @@ -359,7 +348,6 @@ public class OagisShipmentServices { } } } - } catch (NumberFormatException e) { String errMsg = "Error in format for number: " + e.toString(); errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "NumberFormatException")); @@ -386,10 +374,43 @@ public class OagisShipmentServices { } } + Map result = FastMap.newInstance(); + result.put("logicalId", logicalId); + result.put("component", component); + result.put("task", task); + result.put("referenceId", referenceId); + result.put("userLogin", userLogin); + if (errorMapList.size() > 0) { + // call services createOagisMsgErrInfosFromErrMapList and for incoming messages oagisSendConfirmBod + Map saveErrorMapListCtx = FastMap.newInstance(); + saveErrorMapListCtx.put("logicalId", logicalId); + saveErrorMapListCtx.put("component", component); + saveErrorMapListCtx.put("task", task); + saveErrorMapListCtx.put("referenceId", referenceId); + saveErrorMapListCtx.put("errorMapList", errorMapList); + try { + dispatcher.runSync("createOagisMsgErrInfosFromErrMapList", saveErrorMapListCtx, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + Debug.logError(e, errMsg, module); + } + + try { + Map sendConfirmBodCtx = FastMap.newInstance(); + sendConfirmBodCtx.putAll(saveErrorMapListCtx); + // NOTE: this is different for each service, should be shipmentId or returnId or PO orderId or etc + sendConfirmBodCtx.put("origRefId", shipmentId); + + // run async because this will send a message back to the other server and may take some time, and/or fail + dispatcher.runAsync("oagisSendConfirmBod", sendConfirmBodCtx, null, true, 60, true); + } catch (GenericServiceException e){ + String errMsg = "Error updating OagisMessageInfo for the Incoming Message: " + e.toString(); + Debug.logError(e, errMsg, module); + } + // DEJ20070807 what was this next line commented out? if there are errors we want to return an error so this will roll back - result.putAll(ServiceUtil.returnError("Errors found processing message")); - result.put("errorMapList", errorMapList); + result.putAll(ServiceUtil.returnError("Errors found processing message; information saved and return error sent back")); return result; } else { oagisMsgInfoCtx.put("processingStatusId", "OAGMP_PROC_SUCCESS");