Author: apatel
Date: Fri Jul 20 20:56:36 2007 New Revision: 558236 URL: http://svn.apache.org/viewvc?view=rev&rev=558236 Log: Reverted changed made in last commit. Modified: ofbiz/trunk/specialpurpose/oagis/servicedef/secas.xml ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml 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=558236&r1=558235&r2=558236 ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/servicedef/secas.xml (original) +++ ofbiz/trunk/specialpurpose/oagis/servicedef/secas.xml Fri Jul 20 20:56:36 2007 @@ -28,9 +28,9 @@ <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/> <action service="oagisProcessShipment" mode="sync"/> </eca--> - <!--eca service="oagisPocessShipment" event="commit" run-on-error="false"> + <eca service="oagisPocessShipment" event="commit" run-on-error="false"> <action service="createOagisMessageInfo" mode="sync"/> - </eca--> + </eca> <!--<eca service="receiveConfirmBod" event="commit" run-on-error="true"> <action service="createOagisMessageInfo" mode="sync"/> Modified: ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml?view=diff&rev=558236&r1=558235&r2=558236 ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml (original) +++ ofbiz/trunk/specialpurpose/oagis/servicedef/services.xml Fri Jul 20 20:56:36 2007 @@ -45,7 +45,7 @@ <attribute name="errorMapList" type="java.util.List" mode="OUT" optional="true"/> </service> - <service name="createOagisMessageInfo" engine="simple" default-entity-name="OagisMessageInfo" + <service name="createOagisMessageInfo" engine="simple" default-entity-name="OagisMessageInfo" location="org/ofbiz/oagis/OagisMessageServices.xml" invoke="createOagisMessageInfo" auth="true"> <description>Create MessageInfo</description> <auto-attributes mode="IN" include="pk" optional="false"/> @@ -65,7 +65,7 @@ <auto-attributes mode="IN" include="pk" optional="false"/> <auto-attributes mode="IN" include="nonpk" optional="true"/> <override name="errorSeqId" optional="true"/> - </service> + </service> <service name="updateOagisMessageErrorInfo" engine="simple" default-entity-name="OagisMessageErrorInfo" location="org/ofbiz/oagis/OagisMessageServices.xml" invoke="updateOagisMessageErrorInfo" auth="true"> @@ -119,17 +119,17 @@ <attribute name="bodyParameters" type="Map" mode="IN" optional="true"/> <attribute name="body" type="String" mode="OUT" optional="true"/> </service> - <service name="oagisProcessShipment" max-retry="0" engine="java" + <service name="oagisProcessShipment" max-retry="0" engine="java" location="org.ofbiz.oagis.OagisShipmentServices" invoke="oagisProcessShipment"> <description>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.</description> - <!--implements service="oagisMessageInfoInterface"/--> + <implements service="oagisMessageInfoInterface"/> <attribute name="sendToUrl" type="String" mode="IN" optional="true"/> <attribute name="saveToFilename" type="String" mode="IN" optional="true"/> <attribute name="saveToDirectory" type="String" mode="IN" optional="true"/> <attribute name="outputStream" type="java.io.OutputStream" mode="IN" optional="true"/> - <attribute name="orderId" mode="IN" type="String" optional="false"/> + <override name="orderId" mode="INOUT" type="String" optional="false"/> </service> <service name="sendProcessShipmentMsg" max-retry="0" engine="simple" location="org/ofbiz/oagis/OagisMessageServices.xml" invoke="sendProcessShipmentMsg"> 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=558236&r1=558235&r2=558236 ============================================================================== --- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java (original) +++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisShipmentServices.java Fri Jul 20 20:56:36 2007 @@ -36,7 +36,6 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TreeSet; @@ -44,7 +43,6 @@ import javax.xml.parsers.ParserConfigurationException; import javolution.util.FastList; -import javolution.util.FastMap; import javolution.util.FastSet; import org.ofbiz.base.util.Debug; @@ -249,10 +247,8 @@ String saveToFilename = (String) context.get("saveToFilename"); String saveToDirectory = (String) context.get("saveToDirectory"); OutputStream out = (OutputStream) context.get("outputStream"); - Locale locale = (Locale) context.get("locale"); Map result = ServiceUtil.returnSuccess(); - Map comiCtx = new HashMap(); MapStack bodyParameters = MapStack.create(); if (userLogin == null) { try { @@ -261,251 +257,215 @@ Debug.logError(e, "Error getting userLogin", module); } } - // check payment authorization - boolean checkPaymentAuth = false; - if (orderId != null) { - Map serviceContext = FastMap.newInstance(); - serviceContext.put("orderId", orderId); - serviceContext.put("userLogin", userLogin); - Map authResult = null; - try { - authResult = dispatcher.runSync("authOrderPayments", serviceContext); - String processResult = (String) authResult.get("processResult"); - if (processResult.equals("APPROVED")) { - checkPaymentAuth = true; - Debug.logInfo("payment authorization completed: ", module); - } else { - Debug.logInfo("payment authorization could not completed: ", module); - } - } catch (GenericServiceException e) { - String errMsg = "Error authorizing payment: " + e.toString(); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); - } + GenericValue orderHeader = null; + GenericValue orderItemShipGroup = null; + try { + orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); + } catch (GenericEntityException e) { + Debug.logError(e, module); + return ServiceUtil.returnError(e.getMessage()); } - if (checkPaymentAuth) { - GenericValue orderHeader = null; - GenericValue orderItemShipGroup = null; - try { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); - } catch (GenericEntityException e) { - Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); - } - GenericValue shipment =null; - if (orderHeader != null) { - String orderStatusId = orderHeader.getString("statusId"); - if (orderStatusId.equals("ORDER_APPROVED")) { - try { - Map cospResult= dispatcher.runSync("createOrderShipmentPlan", UtilMisc.toMap("orderId", orderId, "userLogin", userLogin)); - shipmentId = (String) cospResult.get("shipmentId"); - } catch (GenericServiceException e) { - Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); - } - try { - shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); - bodyParameters.put("shipment", shipment); - OrderReadHelper orderReadHelper = new OrderReadHelper(orderHeader); - if(orderReadHelper.hasShippingAddress()) { - GenericValue address = EntityUtil.getFirst(orderReadHelper.getShippingLocations()); - bodyParameters.put("address", address); - } - String emailString = orderReadHelper.getOrderEmailString(); - bodyParameters.put("emailString", emailString); - - String contactMechId = shipment.getString("destinationTelecomNumberId"); - GenericValue telecomNumber = delegator.findByPrimaryKey("TelecomNumber", UtilMisc.toMap("contactMechId", contactMechId)); - bodyParameters.put("telecomNumber", telecomNumber); - - List shipmentItems = delegator.findByAnd("ShipmentItem", UtilMisc.toMap("shipmentId", shipmentId)); - bodyParameters.put("shipmentItems", shipmentItems); - - orderItemShipGroup = EntityUtil.getFirst(delegator.findByAnd("OrderItemShipGroup", UtilMisc.toMap("orderId", orderId))); - bodyParameters.put("orderItemShipGroup", orderItemShipGroup); - } catch (GenericEntityException e) { - Debug.logError(e, module); + GenericValue shipment =null; + if (orderHeader != null) { + String orderStatusId = orderHeader.getString("statusId"); + if (orderStatusId.equals("ORDER_APPROVED")) { + try { + Map cospResult= dispatcher.runSync("createOrderShipmentPlan", UtilMisc.toMap("orderId", orderId, "userLogin", userLogin)); + shipmentId = (String) cospResult.get("shipmentId"); + } catch (GenericServiceException e) { + Debug.logError(e, module); + return ServiceUtil.returnError(e.getMessage()); + } + try { + shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); + bodyParameters.put("shipment", shipment); + OrderReadHelper orderReadHelper = new OrderReadHelper(orderHeader); + if(orderReadHelper.hasShippingAddress()) { + GenericValue address = EntityUtil.getFirst(orderReadHelper.getShippingLocations()); + bodyParameters.put("address", address); } + String emailString = orderReadHelper.getOrderEmailString(); + bodyParameters.put("emailString", emailString); + + String contactMechId = shipment.getString("destinationTelecomNumberId"); + GenericValue telecomNumber = delegator.findByPrimaryKey("TelecomNumber", UtilMisc.toMap("contactMechId", contactMechId)); + bodyParameters.put("telecomNumber", telecomNumber); + + List shipmentItems = delegator.findByAnd("ShipmentItem", UtilMisc.toMap("shipmentId", shipmentId)); + bodyParameters.put("shipmentItems", shipmentItems); - Set correspondingPoIdSet = FastSet.newInstance(); - try { - List orderItems = delegator.findByAnd("OrderItem", UtilMisc.toMap("orderId", shipment.getString("primaryOrderId"))); - Iterator oiIter = orderItems.iterator(); - while (oiIter.hasNext()) { - GenericValue orderItem = (GenericValue) oiIter.next(); - String correspondingPoId = orderItem.getString("correspondingPoId"); - if (correspondingPoId != null) { - correspondingPoIdSet.add(correspondingPoId); - } + orderItemShipGroup = EntityUtil.getFirst(delegator.findByAnd("OrderItemShipGroup", UtilMisc.toMap("orderId", orderId))); + bodyParameters.put("orderItemShipGroup", orderItemShipGroup); + } catch (GenericEntityException e) { + Debug.logError(e, module); + } + + Set correspondingPoIdSet = FastSet.newInstance(); + try { + List orderItems = delegator.findByAnd("OrderItem", UtilMisc.toMap("orderId", shipment.getString("primaryOrderId"))); + Iterator oiIter = orderItems.iterator(); + while (oiIter.hasNext()) { + GenericValue orderItem = (GenericValue) oiIter.next(); + String correspondingPoId = orderItem.getString("correspondingPoId"); + if (correspondingPoId != null) { + correspondingPoIdSet.add(correspondingPoId); } - } catch (GenericEntityException e) { - Debug.logError(e, module); } - bodyParameters.put("correspondingPoIdSet", correspondingPoIdSet); - - Set externalIdSet = FastSet.newInstance(); - try { - GenericValue primaryOrderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", shipment.getString("primaryOrderId"))); - String externalId = primaryOrderHeader.getString("externalId"); - if (externalId != null) { - externalIdSet.add(externalId); + } catch (GenericEntityException e) { + Debug.logError(e, module); + } + bodyParameters.put("correspondingPoIdSet", correspondingPoIdSet); + + Set externalIdSet = FastSet.newInstance(); + try { + GenericValue primaryOrderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", shipment.getString("primaryOrderId"))); + externalIdSet.add(primaryOrderHeader.getString("externalId")); + } catch (GenericEntityException e) { + Debug.logError(e, module); + } + bodyParameters.put("externalIdSet", externalIdSet); + + // Check if order was a return replacement order (associated with return) + List returnItemResponses = null; + List returnItemRespExprs = UtilMisc.toList(new EntityExpr("replacementOrderId", EntityOperator.NOT_EQUAL, null)); + EntityCondition returnItemRespCond = new EntityConditionList(returnItemRespExprs, EntityOperator.AND); + // list of fields to select (initial list) + List fieldsToSelect = FastList.newInstance(); + fieldsToSelect.add("replacementOrderId"); + try { + returnItemResponses = delegator.findByCondition("ReturnItemResponse", returnItemRespCond, fieldsToSelect, null); + Iterator rirIter = returnItemResponses.iterator(); + while (rirIter.hasNext()) { + GenericValue returnItemResponse = (GenericValue) rirIter.next(); + String replacementOrderId = returnItemResponse.getString("replacementOrderId"); + if (replacementOrderId.equals(shipment.getString("primaryOrderId"))) { + bodyParameters.put("shipnotes", "RETURNLABEL"); + + // Get the associated return Id (replaceReturnId) + String returnItemResponseId = returnItemResponse.getString("returnItemResponseId"); + GenericValue returnItem = EntityUtil.getFirst(delegator.findByAnd("ReturnItem", UtilMisc.toMap("returnItemResponseId", returnItemResponseId))); + bodyParameters.put("replacementReturnId", returnItem.getString("returnId")); } - } catch (GenericEntityException e) { - Debug.logError(e, module); } - bodyParameters.put("externalIdSet", externalIdSet); + } catch (GenericEntityException e) { + Debug.logError(e, module); + } + String logicalId = UtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.LOGICALID"); + bodyParameters.put("logicalId", logicalId); + result.put("logicalId", logicalId); + + String authId = UtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.AUTHID"); + bodyParameters.put("authId", authId); + result.put("authId", authId); + + String referenceId = delegator.getNextSeqId("OagisMessageInfo"); + bodyParameters.put("referenceId", referenceId); + result.put("referenceId", referenceId); - // if order was a return replacement order (associated with return) - List returnItemResponses = null; - List returnItemRespExprs = UtilMisc.toList(new EntityExpr("replacementOrderId", EntityOperator.NOT_EQUAL, null)); - EntityCondition returnItemRespCond = new EntityConditionList(returnItemRespExprs, EntityOperator.AND); - // list of fields to select (initial list) - List fieldsToSelect = FastList.newInstance(); - fieldsToSelect.add("replacementOrderId"); - try { - returnItemResponses = delegator.findByCondition("ReturnItemResponse", returnItemRespCond, fieldsToSelect, null); - Iterator rirIter = returnItemResponses.iterator(); - while (rirIter.hasNext()) { - GenericValue returnItemResponse = (GenericValue) rirIter.next(); - String replacementOrderId = returnItemResponse.getString("replacementOrderId"); - if (replacementOrderId.equals(shipment.getString("primaryOrderId"))) { - bodyParameters.put("shipnotes", "RETURNLABEL"); - - // Get the associated return Id (replaceReturnId) - String returnItemResponseId = returnItemResponse.getString("returnItemResponseId"); - GenericValue returnItem = EntityUtil.getFirst(delegator.findByAnd("ReturnItem", UtilMisc.toMap("returnItemResponseId", returnItemResponseId))); - bodyParameters.put("replacementReturnId", returnItem.getString("returnId")); + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'Z"); + Timestamp timestamp = UtilDateTime.nowTimestamp(); + String sentDate = dateFormat.format(timestamp); + bodyParameters.put("sentDate", sentDate); + result.put("sentDate", timestamp); + + // tracking shipper account + String partyId = shipment.getString("partyIdTo"); + List partyCarrierAccounts = new ArrayList(); + try { + partyCarrierAccounts = delegator.findByAnd("PartyCarrierAccount", UtilMisc.toMap("partyId", partyId)); + partyCarrierAccounts = EntityUtil.filterByDate(partyCarrierAccounts); + if (partyCarrierAccounts != null) { + Iterator pcaIter = partyCarrierAccounts.iterator(); + while (pcaIter.hasNext()) { + GenericValue partyCarrierAccount = (GenericValue) pcaIter.next(); + String carrierPartyId = partyCarrierAccount.getString("carrierPartyId"); + if (carrierPartyId.equals(orderItemShipGroup.getString("carrierPartyId"))) { + String accountNumber = partyCarrierAccount.getString("accountNumber"); + bodyParameters.put("shipperId", accountNumber); } } - } catch (GenericEntityException e) { - Debug.logError(e, module); } - String logicalId = UtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.LOGICALID"); - bodyParameters.put("logicalId", logicalId); - comiCtx.put("logicalId", logicalId); - - String authId = UtilProperties.getPropertyValue("oagis.properties", "CNTROLAREA.SENDER.AUTHID"); - bodyParameters.put("authId", authId); - comiCtx.put("authId", authId); - - String referenceId = delegator.getNextSeqId("OagisMessageInfo"); - bodyParameters.put("referenceId", referenceId); - comiCtx.put("referenceId", referenceId); - - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'Z"); - Timestamp timestamp = UtilDateTime.nowTimestamp(); - String sentDate = dateFormat.format(timestamp); - bodyParameters.put("sentDate", sentDate); - comiCtx.put("sentDate", timestamp); - - // tracking shipper account - String partyId = shipment.getString("partyIdTo"); - List partyCarrierAccounts = new ArrayList(); - try { - partyCarrierAccounts = delegator.findByAnd("PartyCarrierAccount", UtilMisc.toMap("partyId", partyId)); - partyCarrierAccounts = EntityUtil.filterByDate(partyCarrierAccounts); - if (partyCarrierAccounts != null) { - Iterator pcaIter = partyCarrierAccounts.iterator(); - while (pcaIter.hasNext()) { - GenericValue partyCarrierAccount = (GenericValue) pcaIter.next(); - String carrierPartyId = partyCarrierAccount.getString("carrierPartyId"); - if (carrierPartyId.equals(orderItemShipGroup.getString("carrierPartyId"))) { - String accountNumber = partyCarrierAccount.getString("accountNumber"); - bodyParameters.put("shipperId", accountNumber); - } - } + } catch (GenericEntityException e) { + Debug.logError(e, module); + } + bodyParameters.put("shipmentId", shipmentId); + bodyParameters.put("orderId", orderId); + bodyParameters.put("userLogin", userLogin); + String bodyScreenUri = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Template.ProcessShipment"); + + Writer writer = null; + if (out != null) { + writer = new OutputStreamWriter(out); + } else if (UtilValidate.isNotEmpty(saveToFilename)) { + try { + File outdir = new File(saveToDirectory); + if (!outdir.exists()) { + outdir.mkdir(); } - } catch (GenericEntityException e) { - Debug.logError(e, module); + writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, saveToFilename)), "UTF-8"))); + } catch (Exception e) { + String errMsg = "Error opening file to save message to [" + saveToFilename + "]: " + e.toString(); + Debug.logError(e, errMsg, module); + return ServiceUtil.returnError(errMsg); + } + } else if (UtilValidate.isNotEmpty(sendToUrl)) { + writer = new StringWriter(); + } + + ScreenRenderer screens = new ScreenRenderer(writer, bodyParameters, new HtmlScreenRenderer()); + try { + screens.render(bodyScreenUri); + writer.close(); + } catch (Exception e) { + String errMsg = "Error rendering message: " + e.toString(); + Debug.logError(e, errMsg, module); + return ServiceUtil.returnError(errMsg); + } + + // TODO: call service with require-new-transaction=true to save the OagisMessageInfo data (to make sure it saves before) + + if (UtilValidate.isNotEmpty(sendToUrl)) { + HttpClient http = new HttpClient(sendToUrl); + + // test parameters + http.setHostVerificationLevel(SSLUtil.HOSTCERT_NO_CHECK); + http.setAllowUntrusted(true); + http.setDebug(true); + + // needed XML post parameters + if (UtilValidate.isNotEmpty(certAlias)) { + http.setClientCertificateAlias(certAlias); } - bodyParameters.put("shipmentId", shipmentId); - bodyParameters.put("orderId", orderId); - bodyParameters.put("userLogin", userLogin); - String bodyScreenUri = UtilProperties.getPropertyValue("oagis.properties", "Oagis.Template.ProcessShipment"); - - Writer writer = null; - if (out != null) { - writer = new OutputStreamWriter(out); - } else if (UtilValidate.isNotEmpty(saveToFilename)) { - try { - File outdir = new File(saveToDirectory); - if (!outdir.exists()) { - outdir.mkdir(); - } - writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(outdir, saveToFilename)), "UTF-8"))); - } catch (Exception e) { - String errMsg = "Error opening file to save message to [" + saveToFilename + "]: " + e.toString(); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); - } - } else if (UtilValidate.isNotEmpty(sendToUrl)) { - writer = new StringWriter(); + if (UtilValidate.isNotEmpty(basicAuthUsername)) { + http.setBasicAuthInfo(basicAuthUsername, basicAuthPassword); } - - ScreenRenderer screens = new ScreenRenderer(writer, bodyParameters, new HtmlScreenRenderer()); + http.setContentType("text/xml"); + http.setKeepAlive(true); + try { - screens.render(bodyScreenUri); - writer.close(); + String resp = http.post(writer.toString()); } catch (Exception e) { - String errMsg = "Error rendering message: " + e.toString(); + String errMsg = "Error posting message to server with UTL [" + sendToUrl + "]: " + e.toString(); Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); } - - // TODO: call service with require-new-transaction=true to save the OagisMessageInfo data (to make sure it saves before) - // prepare map to Create Oagis Message Info - comiCtx.put("component", "INVENTORY"); - comiCtx.put("task", "SHIPREQUES"); // Actual value of task is "SHIPREQUEST" which is more than 10 char - comiCtx.put("outgoingMessage", "Y"); - comiCtx.put("confirmation", "1"); - comiCtx.put("bsrVerb", "PROCESS"); - comiCtx.put("bsrNoun", "SHIPMENT"); - comiCtx.put("bsrRevision", "001"); - comiCtx.put("processingStatusId", orderStatusId); - comiCtx.put("orderId", orderId); - comiCtx.put("shipmentId", shipmentId); - comiCtx.put("userLogin", userLogin); - - try { - Map oagisMsgInfoResult = dispatcher.runSync("createOagisMessageInfo", comiCtx); - } catch (GenericServiceException e){ - String errMsg = UtilProperties.getMessage(ServiceUtil.resource, "OagisErrorInCreatingDataForOagisMessageInfoEntity", locale); - Debug.logError(e, errMsg, module); - } - - if (UtilValidate.isNotEmpty(sendToUrl)) { - HttpClient http = new HttpClient(sendToUrl); - - // test parameters - http.setHostVerificationLevel(SSLUtil.HOSTCERT_NO_CHECK); - http.setAllowUntrusted(true); - http.setDebug(true); - - // needed XML post parameters - if (UtilValidate.isNotEmpty(certAlias)) { - http.setClientCertificateAlias(certAlias); - } - if (UtilValidate.isNotEmpty(basicAuthUsername)) { - http.setBasicAuthInfo(basicAuthUsername, basicAuthPassword); - } - http.setContentType("text/xml"); - http.setKeepAlive(true); - - try { - String resp = http.post(writer.toString()); - } catch (Exception e) { - String errMsg = "Error posting message to server with UTL [" + sendToUrl + "]: " + e.toString(); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); - } - } } + + // prepare map to Create Oagis Message Info + result.put("component", "INVENTORY"); + result.put("task", "SHIPREQUES"); // Actual value of task is "SHIPREQUEST" which is more than 10 char + result.put("outgoingMessage", "Y"); + result.put("confirmation", "1"); + result.put("bsrVerb", "PROCESS"); + result.put("bsrNoun", "SHIPMENT"); + result.put("bsrRevision", "001"); + result.put("processingStatusId", orderStatusId); + result.put("orderId", orderId); + result.put("shipmentId", shipmentId); + result.put("userLogin", userLogin); } - return result; - } else { - String errMsg = "Service failed:"; - return ServiceUtil.returnError(errMsg); - } + } + return result; } public static Map oagisReceiveDelivery(DispatchContext dctx, Map context) { |
Free forum by Nabble | Edit this page |