我正在尝试使用以下代码将.net类库中的虚拟错误消息发送到ESB管理门户。已经消耗了ESB ExceptionHandling Service提供的WCF服务并创建了它的客户端。
ExceptionHandlingClient clientESB = new ExceptionHandlingClient();
FaultMessage faultMsg = new FaultMessage();
faultMsg.Header = new FaultMessageHeader();
faultMsg.Header.Application = "Exception Handling Service Test";
faultMsg.Header.Description = "Fault Message Header";
faultMsg.Header.ErrorType = "Error Type";
faultMsg.Header.FaultSeverity = 1;
faultMsg.Header.FaultCode = "Fault Code";
faultMsg.Header.FailureCategory = "Failure Category";
faultMsg.Header.FaultDescription = "Fault Description";
faultMsg.Header.FaultGenerator = "Fault Generator";
faultMsg.Header.Scope = "Fault Message Scopte";
faultMsg.Header.ServiceInstanceID = System.Guid.NewGuid().ToString();
faultMsg.Header.ServiceName = "Exception Service";
faultMsg.Header.MachineName = System.Environment.MachineName;
faultMsg.Header.DateTime = System.DateTime.Now.ToString();
faultMsg.Header.ControlBit = "1";
faultMsg.Header.MessageID = System.Guid.NewGuid().ToString();
faultMsg.Header.ActivityIdentity = "Activity Identity ";
faultMsg.Header.NACK = false;
//Use the 'client' variable to call operations on the service.
clientESB.Open();
clientESB.SubmitFault(faultMsg);
当上面的代码执行时,它成功设置了FaultMessage对象的属性。此请求到达ALL.Exceptions时发送端口失败,并显示以下错误消息。
执行发送管道失败:" Microsoft.Practices.ESB.ExceptionHandling.Pipelines.ESBFaultProcessor,Microsoft.Practices.ESB.ExceptionHandling.Pipelines,Version = 2.1.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35"资料来源:" ESB BAM Tracker"发送端口:" ALL.Exceptions" URI:" SQL://(local)/ EsbExceptionDb /"原因:发生了意外的文件结束。以下元素未关闭:ns0:FaultMessage。第20行,第12位。
答案 0 :(得分:0)
如果要从BizTalk Orchestration发送异常消息,则可以在构造形状中执行以下操作,以创建类型为Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.FaultMessage
的faultMsg。faultMsg = Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage();
faultMsg.FailureCategory = "Failure Category";
faultMsg.FaultCode = "Fault Code";
faultMsg.FaultSeverity = Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Error;
faultMsg.FaultDescription = "Fault Description";
faultMsg.Scope = "Fault Message Scope";
注意: