Author: apatel
Date: Tue Jul 24 05:50:36 2007 New Revision: 559031 URL: http://svn.apache.org/viewvc?view=rev&rev=559031 Log: cleanup and fixes to use service routing service. Modified: ofbiz/trunk/specialpurpose/oagis/servicedef/secas.xml ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Modified: ofbiz/trunk/specialpurpose/oagis/servicedef/secas.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/servicedef/secas.xml?view=diff&rev=559031&r1=559030&r2=559031 ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/servicedef/secas.xml (original) +++ ofbiz/trunk/specialpurpose/oagis/servicedef/secas.xml Tue Jul 24 05:50:36 2007 @@ -34,27 +34,4 @@ <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> Modified: ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml?view=diff&rev=559031&r1=559030&r2=559031 ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml (original) +++ ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml Tue Jul 24 05:50:36 2007 @@ -88,8 +88,8 @@ <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 @@ <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 @@ <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" Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java?view=diff&rev=559031&r1=559030&r2=559031 ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java (original) +++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisInventoryServices.java Tue Jul 24 05:50:36 2007 @@ -68,7 +68,7 @@ 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 @@ } } - 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 @@ } 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 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 @@ } } - 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 @@ 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 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 @@ 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 @@ } 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)); Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java?view=diff&rev=559031&r1=559030&r2=559031 ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original) +++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Tue Jul 24 05:50:36 2007 @@ -97,27 +97,11 @@ 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 @@ } 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; } |
Free forum by Nabble | Edit this page |