Получавам тази грешка във форма за присвояване на съобщение в моята оркестрация. В рамките на тази форма на присвояване се опитвам да изпълня XPath заявка, за да извлека base64 кодиран низ от съобщение, получено от WCF. След това се опитвам да заредя променлива 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);
}
}
И накрая, това е грешката, която получавам в Event Viewer:
Запис в регистрационния файл на събитието на 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, String opname, String url, IList promoteProps, Boolean track, IList toPromote) в Microsoft.BizTalk.XLANGs.BTXEngine.BTXLogicalPortBinding.SendMessage( XLANGMessage msg, XlangStore store, Segment seg, OperationInfo op, IList AdditionalProps, IList toPromote, Boolean ignoreRoutingFailure) в Microsoft.BizTalk.XLANGs.BTXEng ine.BTXPortBase.SendMessage(Int32 iOperation, XLANGMessage msg, Correlation[] initCorrelations, Correlation[] followCorrelations, Context cxt, Segment seg, ActivityFlags flags) в IAS.Integration.Services.Orchestrations.MainOrchestration.segment1(StopConditions stopOn) в Microsoft. XLANGs.Core.SegmentScheduler.RunASegment(Сегмент s, StopConditions stopCond, Exception& exp)**