private string HandleMessageType(HAPITRANS transfer) { string error = ""; string Url = ""; try { Url = FindUrlToUse(transfer.WEBS_PROFILE_ID, transfer.HAPIOBJECTNAME); Tracing.TraceEvent(TraceEventType.Verbose, 0, String.Format(" use Url = {0}", Url)); if (String.IsNullOrEmpty(Url)) { return("unknown url for " + transfer.WEBS_PROFILE_ID + " - " + transfer.HAPIOBJECTNAME); } sender.Url = Url; switch (transfer.HAPIOBJECTNAME) { case "DR": // -- HAPIOBJECTNAME_Delivery_Receipt { DeliveryReceiptHeadSelect handler = new DeliveryReceiptHeadSelect(this.db); DeliveryReceiptHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.DeliveryReceipt(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "BA": // -- HAPIOBJECTNAME_Balance_Answer { BalanceAnswerLineSelect handler = new BalanceAnswerLineSelect(this.db); BalanceAnswerLineDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.BalanceAnswer(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "PR": // -- HAPIOBJECTNAME_Pick_Receipt { PickReceiptHeadSelect handler = new PickReceiptHeadSelect(this.db); PickReceiptHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.PickReceipt(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "IC": // -- HAPIOBJECTNAME_Item_Change { InventoryChangeLineSelect handler = new InventoryChangeLineSelect(this.db); InventoryChangeLineDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.InventoryChange(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "PM": // -- HAPIOBJECTNAME_Packing_Material { ReturnedPackingMaterialHeadSelect handler = new ReturnedPackingMaterialHeadSelect(this.db); ReturnedPackingMaterialHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.ReturnedPackingMaterial(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "RR": // -- HAPIOBJECTNAME_Return_Receipt { ReturnReceiptHeadSelect handler = new ReturnReceiptHeadSelect(this.db); ReturnReceiptHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.VendorReturnReceipt(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "IR": // -- HAPIOBJECTNAME_Inspection_Receipt { InspectionReceiptHeadSelect handler = new InspectionReceiptHeadSelect(this.db); InspectionReceiptHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.InspectionReceipt(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "SR": // -- HAPIOBJECTNAME_Shipment_Report { ASNHeadSelect handler = new ASNHeadSelect(this.db); ASNHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.ASN(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "COR": // -- HAPIOBJECTNAME_Confirmation_Of_Receipt { ConfirmationOfReceiptHeadSelect handler = new ConfirmationOfReceiptHeadSelect(this.db); ConfirmationOfReceiptHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.ConfirmationOfReceipt(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "IOC": // -- HAPIOBJECTNAME_Inbound_Order_Completed { InboundOrderCompletedSelect handler = new InboundOrderCompletedSelect(this.db); InboundOrderCompletedDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.InboundOrderCompleted(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "TI": // -- HAPIOBJECTNAME_Transport_Instruction { TransportInstructionSelect handler = new TransportInstructionSelect(this.db); TransportInstructionDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.TransportInstruction(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } case "TP": // -- HAPIOBJECTNAME_Trp_Plan { TransportPlanHeadSelect handler = new TransportPlanHeadSelect(this.db); TransportPlanHeadDoc message = handler.Process(transfer.HAPITRANS_ID); if (message == null) { error = string.Format("{0} obj missing.", transfer.HAPIOBJECTNAME); } else { sender.TransportPlan(transfer.CHANNEL_ID, transfer.COMPANY_ID, transfer.HAPITRANS_ID, message); } break; } default: error = string.Format("transfer type {0} not found", transfer.HAPIOBJECTNAME); break; } // switch (transfer.HAPIOBJECTNAME) } catch (UriFormatException e) { error = "The format of the URI is invalid. URL: " + Url + ", HAPITRANS_ID: " + transfer.HAPITRANS_ID + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace; } catch (InvalidOperationException e) { error = "Failed to reach " + sender.Url + " for " + transfer.HAPIOBJECTNAME + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace; } catch (System.Web.Services.Protocols.SoapException e) { error = "Interface mismatch. URL: " + sender.Url + ", HAPIOBJECTNAME: " + transfer.HAPIOBJECTNAME + ", HAPITRANS_ID: " + transfer.HAPITRANS_ID + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace; } catch (Exception e) { error = "Unexpected error. URL: " + sender.Url + ", HAPIOBJECTNAME: " + transfer.HAPIOBJECTNAME + ", HAPITRANS_ID: " + transfer.HAPITRANS_ID + Environment.NewLine + e.Message + Environment.NewLine + e.StackTrace; } return(error); }
public void ReturnedPackingMaterial(string ChannelId, string ChannelRef, string TransactionId, ReturnedPackingMaterialHeadDoc aReturnedPackingMaterialHeadDoc) { EnterProc(); ReturnedPackingMaterialHeadInsert aReturnedPackingMaterialHeadHandler; try { MessageTransaction mt = BeginWebmethod(ChannelId, ChannelRef, TransactionId, "PM"); try { aReturnedPackingMaterialHeadHandler = new ReturnedPackingMaterialHeadInsert(this); } catch (Exception e) { Exception InternalError = new Exception("InternalError: Building insert handler", e); throw (InternalError); } try { if (aReturnedPackingMaterialHeadDoc == null) { Exception InternalError = new Exception("DataError: Root object cannot be null"); throw (InternalError); } aReturnedPackingMaterialHeadHandler.Process(ref mt, null, aReturnedPackingMaterialHeadDoc); GetDataBase().Commit(); } catch (Exception e) { try { GetDataBase().Rollback(); } catch (Exception) {} Exception InternalError = new Exception("DataError: Error processing data", e); throw (InternalError); } } finally { EndWebmethod(); } ExitProc(); return; }
public void ReturnedPackingMaterial(string ChannelId, string ChannelRef, string TransactionId, ReturnedPackingMaterialHeadDoc aReturnedPackingMaterialHeadDoc) { // transform external object to packaged object understandable by BizTalk ReturnedPackingMaterial part = new ReturnedPackingMaterial(); part.ChannelId = ChannelId; part.ChannelRef = ChannelRef; part.TransactionId = TransactionId; part.aReturnedPackingMaterialHeadDoc = aReturnedPackingMaterialHeadDoc; ArrayList inHeaders = null; ArrayList inoutHeaders = null; ArrayList inoutHeaderResponses = null; ArrayList outHeaderResponses = null; SoapUnknownHeader[] unknownHeaderResponses = null; // Parameter information object[] invokeParams = new object[] { part }; ParamInfo[] inParamInfos = new ParamInfo[] { new ParamInfo(typeof(ReturnedPackingMaterial), "part") }; ParamInfo[] outParamInfos = null; // Define the assembly (port) // NOTE! This line is only a sample, it needs to be modified to match your orchestration // at least regarding your project name and the public access token string bodyTypeAssemblyQualifiedName = "YOUR_ORCHESTRATION_PROJECT.FromWMSschema+ReturnedPackingMaterial, YOUR_ORCHESTRATION_PROJECT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=" + "92267163d02e63da"; // BizTalk invocation // NOTE! This line is only a sample, it needs to be modified to match your orchestration // regarding the operation to call this.Invoke("Operation_1", invokeParams, inParamInfos, outParamInfos, 0, bodyTypeAssemblyQualifiedName, inHeaders, inoutHeaders, out inoutHeaderResponses, out outHeaderResponses, null, null, null, out unknownHeaderResponses, true, false); }
public System.IAsyncResult BeginReturnedPackingMaterial(string ChannelId, string ChannelRef, string TransactionId, ReturnedPackingMaterialHeadDoc aReturnedPackingMaterialHeadDoc, System.AsyncCallback callback, object asyncState) { return(this.BeginInvoke("ReturnedPackingMaterial", new object[] { ChannelId, ChannelRef, TransactionId, aReturnedPackingMaterialHeadDoc }, callback, asyncState)); }
public void ReturnedPackingMaterial(string ChannelId, string ChannelRef, string TransactionId, ReturnedPackingMaterialHeadDoc aReturnedPackingMaterialHeadDoc) { this.Invoke("ReturnedPackingMaterial", new object[] { ChannelId, ChannelRef, TransactionId, aReturnedPackingMaterialHeadDoc }); return; }
public void ReturnedPackingMaterial(string ChannelId, string ChannelRef, string TransactionId, ReturnedPackingMaterialHeadDoc aReturnedPackingMaterialHeadDoc) { ReturnedPackingMaterial returnedPackingMaterial = new ReturnedPackingMaterial(); returnedPackingMaterial.aReturnedPackingMaterialHeadDoc = aReturnedPackingMaterialHeadDoc; ForwardHelper forwardHelper = new ForwardHelper(); try { forwardHelper.CreateContext(ChannelId, ChannelRef, TransactionId, "PM"); forwardHelper.Forward(returnedPackingMaterial); } catch (Exception e) { try { forwardHelper.Abort(); } catch { // ignore exceptions in exception handler } Exception InternalError = new Exception("DataError: Error processing data", e); throw (InternalError); } finally { forwardHelper.ReleaseContext(); } return; }