2

我在编排中的消息分配形状中收到此错误。在此分配形状中,我尝试执行 XPath 查询以从 WCF 接收到的消息中提取 base64 编码字符串。然后,我尝试使用由我编写的帮助程序类生成的 Stream 加载 XmlDocument 变量。base64 字符串将是 PDF 或 Excel 文件的内容(注意:这不是 XML)。我读过这可以做到。

这是我的消息分配中使用的表达式:

messageCreator = new IAS.Integration.Services.Helpers.MessageCreator();
System.Diagnostics.EventLog.WriteEntry("IAS.Integration.Services.Orchestration", "MessageCreator Object created");

base64 = xpath(PerformTransformationResponse, "string(/*[local-name()='PerformTransformationResponseWrapper' and namespace-uri()='http://www.iasreo.com/integration/servicetypes']/*[local-name()='TransformedPayload'])");
//System.Diagnostics.EventLog.WriteEntry("IAS.Integration.Services.Orchestration", System.String.Format("Base64 from xpath: {0}", base64));

Output = new System.Xml.XmlDocument();
System.Diagnostics.EventLog.WriteEntry("IAS.Integration.Services.Orchestration", "Output instantiated as XmlDocument");

messageCreator.CreateMyMessage(Output, base64);
System.Diagnostics.EventLog.WriteEntry("IAS.Integration.Services.Orchestration", "messageCreator.CreateMyMessage(Output, base64)");

以下是我为支持此表达式而编写的辅助类:

[Serializable]
public class MessageCreator
{
    public void CreateMyMessage(XLANGMessage outMessage, string binaryStringMessage)
    {
        outMessage[0].LoadFrom(new StreamFactory(binaryStringMessage));
    }
}

[Serializable]
public class StreamFactory : IStreamFactory
{
    private string messageContent;

    public StreamFactory(string inMessageContent)
    {
        messageContent = inMessageContent;
    }

    public Stream CreateStream()
    {
        byte[] messageBytes = Convert.FromBase64String(messageContent);

        return new MemoryStream(messageBytes, 0, messageBytes.Length, true, true);
    }
}

最后,这是我在事件查看器中收到的错误:

xlang/s 引擎事件日志条目:未捕获的异常(参见下面的“内部异常”)已暂停服务“IAS.Integration.Services.Orchestrations.MainOrchestration(fcad6d68-ce54-bfa2-d035-56608b99ef52)”的实例。服务实例将保持挂起状态,直到以管理方式恢复或终止。如果恢复,实例将从其上次持久状态继续,并可能重新引发相同的意外异常。InstanceId:c398fd2a-b654-4981-be13-94146d640375 形状名称:Send_StreamedDocument ShapeId:bc7a463b-eed2-4222-b2f7-3fdb1e44a3c5 引发异常:段 1,进度 25 内部异常:消息“输出”的“部分”部分包含零字节的数据。

异常类型:EmptyPartException 源:Microsoft.XLANGs.Engine 目标站点:System.IO.Stream Persist(System.String ByRef, Boolean) 以下是标识 Microsoft.XLANGs.Core.Part 发生异常的位置的堆栈跟踪.Persist(String& encoding, Boolean wantEncoding) 在 Microsoft.BizTalk.XLANGs.BTXEngine.BTXXlangStore.StagePartData(Part part) 在 Microsoft.BizTalk.XLANGs.BTXEngine.BTXXlangStore.PrepareMessage(XLANGMessage msg, IList promoteProps, IList toPromote) 在 Microsoft。 BizTalk.XLANGs.BTXEngine.BTXXlangStore.WriteMessageState(IBTPEPInfoLookup pepLookup,Guid portId,XLANGMessage msg,Segment seg,字符串 opname,字符串 url,IList 提升属性,布尔轨道,IList toPromote)在 Microsoft.BizTalk.XLANGs.BTXEngine.BTXLogicalPortBinding.SendMessage( XLANGMessage 消息,Microsoft.BizTalk.XLANGs.BTXEngine.BTXPortBase.SendMessage (Int32 iOperation, XLANGMessage msg, Correlation[] initCorrelations, Correlation[] followCorrelations, Context cxt,段段,ActivityFlags 标志)在 IAS.Integration.Services.Orchestrations.MainOrchestration.segment1(StopConditions stopOn)在 Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,StopConditions stopCond,异常和 exp)**ActivityFlags 标志)在 IAS.Integration.Services.Orchestration.MainOrchestration.segment1(StopConditions stopOn)在 Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,StopConditions stopCond,Exception& exp)**ActivityFlags 标志)在 IAS.Integration.Services.Orchestration.MainOrchestration.segment1(StopConditions stopOn)在 Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s,StopConditions stopCond,Exception& exp)**

4

1 回答 1

1

当您在发送消息之前将消息序列化为持久状态的一部分时,我可以看到它正在发生。“形状名称:Send_StreamedDocument”

您的 OutPut 消息是定义为简单消息还是多部分消息?

您是否尝试过将 OutPut 消息设为字符串而不是 XMLDocument?

编辑:实际上 XMLDocument 本身不是可序列化的。我不知道 - 我想我总是设法在发送消息之前将消息输入到基于模式的东西中。
见这里:http ://talentedmonkeys.wordpress.com/2010/02/15/xmldocument-serialization-in-biztalk-2009-not/ 在这里: http : //extremelytalentedmonkeys.blogspot.com/2009/12/xmldocument-序列化-not.html

您可以将消息分配和发送形状包装在原子事务中,这样您就可以避免尝试持久化不可序列化的内容。或者您可以使用 XMLDocument 以外的其他东西?

于 2012-03-09T02:06:57.327 回答