cleanup and fixes to use service routing service.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk/specialpurpose@559031 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Anil Patel
2007-07-24 12:50:36 +00:00
parent 4cf3037f94
commit 8b2b6e64bd
4 changed files with 31 additions and 131 deletions
-23
View File
@@ -34,27 +34,4 @@ under the License.
<action service="oagisSendConfirmBod" mode="sync"/>
</eca>
<eca service="showShipment" event="commit" run-on-error="true">
<condition field-name="errorMapList" operator="is-not-empty"/>
<action service="createOagisMsgErrInfosFromErrMapList" mode="sync"/>
<action service="oagisSendConfirmBod" mode="sync"/>
</eca>
<eca service="syncInventory" event="commit" run-on-error="true">
<condition field-name="errorMapList" operator="is-not-empty"/>
<action service="createOagisMsgErrInfosFromErrMapList" mode="sync"/>
<action service="oagisSendConfirmBod" mode="sync"/>
</eca>
<eca service="receivePoAcknowledge" event="commit" run-on-error="true">
<condition field-name="errorMapList" operator="is-not-empty"/>
<action service="createOagisMsgErrInfosFromErrMapList" mode="sync"/>
<action service="oagisSendConfirmBod" mode="sync"/>
</eca>
<eca service="receiveRmaAcknowledge" event="commit" run-on-error="true">
<condition field-name="errorMapList" operator="is-not-empty"/>
<action service="createOagisMsgErrInfosFromErrMapList" mode="sync"/>
<action service="oagisSendConfirmBod" mode="sync"/>
</eca>
</service-eca>
+4 -4
View File
@@ -88,8 +88,8 @@ under the License.
<service name="showShipment" engine="java" transaction-timeout="300"
location="org.ofbiz.oagis.OagisShipmentServices" invoke="showShipment" auth="false">
<description>Process incoming shipment message</description>
<implements service="serviceStreamInterface"/>
<implements service="oagisMessageErrorInfoInterface"/>
<attribute name="document" type="org.w3c.dom.Document" mode="IN" optional="false"/>
</service>
<service name="oagisSendConfirmBod" engine="java" transaction-timeout="300"
@@ -117,8 +117,8 @@ under the License.
<service name="syncInventory" engine="java" transaction-timeout="300"
location="org.ofbiz.oagis.OagisInventoryServices" invoke="syncInventory" auth="false">
<description>Process incoming Inventory Sync message</description>
<implements service="serviceStreamInterface"/>
<implements service="oagisMessageErrorInfoInterface"/>
<attribute name="document" type="org.w3c.dom.Document" mode="IN" optional="false"/>
</service>
<service name="exportMsgFromScreen" max-retry="0" engine="java"
@@ -165,15 +165,15 @@ under the License.
<service name="receivePoAcknowledge" engine="java" transaction-timeout="300"
location="org.ofbiz.oagis.OagisInventoryServices" invoke="receivePoAcknowledge" auth="false">
<description>Process PO Acknowledge message</description>
<implements service="serviceStreamInterface"/>
<implements service="oagisMessageErrorInfoInterface"/>
<attribute name="document" type="org.w3c.dom.Document" mode="IN" optional="false"/>
</service>
<service name="receiveRmaAcknowledge" engine="java" transaction-timeout="300"
location="org.ofbiz.oagis.OagisInventoryServices" invoke="receiveRmaAcknowledge" auth="false">
<description>Process RMA Acknowledge message</description>
<implements service="serviceStreamInterface"/>
<implements service="oagisMessageErrorInfoInterface"/>
<attribute name="document" type="org.w3c.dom.Document" mode="IN" optional="false"/>
</service>
<service name="oagisMessageHandler" engine="java" transaction-timeout="300"
@@ -68,7 +68,7 @@ public class OagisInventoryServices {
public static final Double doubleOne = new Double(1.0);
public static Map syncInventory(DispatchContext ctx, Map context) {
InputStream in = (InputStream) context.get("inputStream");
Document doc = (Document) context.get("document");
GenericValue userLogin = (GenericValue) context.get("userLogin");
GenericDelegator delegator = ctx.getDelegator();
LocalDispatcher dispatcher = ctx.getDispatcher();
@@ -85,26 +85,6 @@ public class OagisInventoryServices {
}
}
Document doc = null;
try {
doc = UtilXml.readXmlDocument(in, true, "SyncInventory");
} catch (SAXException e) {
String errMsg = "Error parsing the SyncInventoryResponse: " + e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "SAXException", "description", errMsg));
Debug.logError(e, errMsg, module);
} catch (ParserConfigurationException e) {
String errMsg = "Error parsing the SyncInventoryResponse: " + e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "ParserConfigurationException", "description", errMsg));
Debug.logError(e, errMsg, module);
} catch (IOException e) {
String errMsg = "Error parsing the SyncInventoryResponse: " + e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "IOException", "description", errMsg));
Debug.logError(e, errMsg, module);
}
if (errorMapList.size() > 0) {
return ServiceUtil.returnError("Unable to parse message: SyncInventory");
}
Element syncInventoryRootElement = doc.getDocumentElement();
syncInventoryRootElement.normalize();
Element docCtrlAreaElement = UtilXml.firstChildElement(syncInventoryRootElement, "os:CNTROLAREA");
@@ -296,15 +276,14 @@ public class OagisInventoryServices {
}
Map result = FastMap.newInstance();
result.put("contentType", "text/plain");
result.put("logicalId", logicalId);
result.put("component", component);
result.put("task", task);
result.put("referenceId", referenceId);
result.put("userLogin", userLogin);
// check error list if there is any
if (errorMapList.size() > 0) {
result.put("logicalId", logicalId);
result.put("component", component);
result.put("task", task);
result.put("referenceId", referenceId);
result.put("userLogin", userLogin);
result.put("errorMapList", errorMapList);
String errMsg = "Error Processing Received Messages";
result.putAll(ServiceUtil.returnError(errMsg));
@@ -315,7 +294,7 @@ public class OagisInventoryServices {
}
public static Map receivePoAcknowledge(DispatchContext ctx, Map context) {
InputStream in = (InputStream) context.get("inputStream");
Document doc = (Document) context.get("document");
GenericValue userLogin = (GenericValue) context.get("userLogin");
LocalDispatcher dispatcher = ctx.getDispatcher();
GenericDelegator delegator = ctx.getDelegator();
@@ -330,26 +309,6 @@ public class OagisInventoryServices {
}
}
Document doc = null;
try {
doc = UtilXml.readXmlDocument(in, true, "ReceivePoAcknowledge");
} catch (SAXException e) {
String errMsg = "Error parsing the ReceivePoAcknowledge message: " + e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "SAXException", "description", errMsg));
Debug.logError(e, errMsg, module);
} catch (ParserConfigurationException e) {
String errMsg = "Error parsing the ReceivePoAcknowledge message: " + e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "ParserConfigurationException", "description", errMsg));
Debug.logError(e, errMsg, module);
} catch (IOException e) {
String errMsg = "Error parsing the ReceivePoAcknowledge message: " + e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "IOException", "description", errMsg));
Debug.logError(e, errMsg, module);
}
if (errorMapList.size() > 0) {
return ServiceUtil.returnError("Unable to parse message: ReceivePoAcknowledge");
}
// parse the message
Element receivePoElement = doc.getDocumentElement();
receivePoElement.normalize();
@@ -555,14 +514,13 @@ public class OagisInventoryServices {
Debug.logError(e, errMsg, module);
}
Map result = FastMap.newInstance();
result.put("contentType", "text/plain");
result.put("logicalId", logicalId);
result.put("component", component);
result.put("task", task);
result.put("referenceId", referenceId);
result.put("userLogin", userLogin);
if (errorMapList.size() > 0) {
result.put("logicalId", logicalId);
result.put("component", component);
result.put("task", task);
result.put("referenceId", referenceId);
result.put("userLogin", userLogin);
result.put("errorMapList", errorMapList);
String errMsg = "Error Processing Received Messages";
result.putAll(ServiceUtil.returnError(errMsg));
@@ -573,7 +531,7 @@ public class OagisInventoryServices {
}
public static Map receiveRmaAcknowledge(DispatchContext ctx, Map context) {
InputStream in = (InputStream) context.get("inputStream");
Document doc = (Document) context.get("document");
GenericValue userLogin = (GenericValue) context.get("userLogin");
LocalDispatcher dispatcher = ctx.getDispatcher();
GenericDelegator delegator = ctx.getDelegator();
@@ -587,26 +545,7 @@ public class OagisInventoryServices {
Debug.logError(e, errMsg, module);
}
}
Document doc = null;
try {
doc = UtilXml.readXmlDocument(in, true, "ReceiveRmaAcknowledge");
} catch (SAXException e) {
String errMsg = "Error parsing the ReceiveRmaAcknowledgeResponse: " + e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "SAXException", "description", errMsg));
Debug.logError(e, errMsg, module);
} catch (ParserConfigurationException e) {
String errMsg = "Error parsing the ReceiveRmaAcknowledgeResponse: " + e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "ParserConfigurationException", "description", errMsg));
Debug.logError(e, errMsg, module);
} catch (IOException e) {
String errMsg = "Error parsing the ReceiveRmaAcknowledgeResponse: " + e.toString();
errorMapList.add(UtilMisc.toMap("reasonCode", "IOException", "description", errMsg));
Debug.logError(e, errMsg, module);
}
if (errorMapList.size() > 0) {
return ServiceUtil.returnError("Unable to parse message: ReceiveRmaAcknowledge");
}
// parse the message
Element receiveRmaElement = doc.getDocumentElement();
receiveRmaElement.normalize();
@@ -804,13 +743,13 @@ public class OagisInventoryServices {
}
Map result = FastMap.newInstance();
result.put("contentType", "text/plain");
result.put("logicalId", logicalId);
result.put("component", component);
result.put("task", task);
result.put("referenceId", referenceId);
result.put("userLogin", userLogin);
if (errorMapList.size() > 0) {
result.put("logicalId", logicalId);
result.put("component", component);
result.put("task", task);
result.put("referenceId", referenceId);
result.put("userLogin", userLogin);
result.put("errorMapList", errorMapList);
String errMsg = "Error Processing Received Messages";
result.putAll(ServiceUtil.returnError(errMsg));
@@ -97,27 +97,11 @@ public class OagisShipmentServices {
public static final String oagisFieldsNamespacePrefix = "of";
public static Map showShipment(DispatchContext ctx, Map context) {
InputStream in = (InputStream) context.get("inputStream");
Document doc = (Document) context.get("document");
LocalDispatcher dispatcher = ctx.getDispatcher();
GenericDelegator delegator = ctx.getDelegator();
List errorMapList = FastList.newInstance();
Document doc = null;
try {
doc = UtilXml.readXmlDocument(in, true, "ShowShipment");
} catch (SAXException e) {
String errMsg = "Error parsing the ShowShipmentResponse: "+e.toString();
errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "SAXException"));
Debug.logError(e, errMsg, module);
} catch (ParserConfigurationException e) {
String errMsg = "Error parsing the ShowShipmentResponse: "+e.toString();
errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "ParserConfigurationException"));
Debug.logError(e, errMsg, module);
} catch (IOException e) {
String errMsg = "Error parsing the ShowShipmentResponse: "+e.toString();
errorMapList.add(UtilMisc.toMap("description", errMsg, "reasonCode", "IOException"));
Debug.logError(e, errMsg, module);
}
GenericValue userLogin =null;
try {
@@ -260,14 +244,14 @@ public class OagisShipmentServices {
}
Map result = new HashMap();
result.put("contentType","text/plain");
result.put("logicalId", logicalId);
result.put("component", component);
result.put("task", task);
result.put("referenceId", referenceId);
result.put("userLogin", userLogin);
if (errorMapList.size() > 0) {
//result.putAll(ServiceUtil.returnError("Errors found processing message"));
result.put("logicalId", logicalId);
result.put("component", component);
result.put("task", task);
result.put("referenceId", referenceId);
result.put("userLogin", userLogin);
result.put("errorMapList", errorMapList);
return result;
}