I am having troubles using an XPath query inside of an expression shape for a received message in an orchestration. Here are the details.
XPath Query:
/*[local-name()='batch']/*[local-name()='rec'][position()='1']/*[local-name()='messageId']
This XPath query is actually from the "Instance XPath" in the Schema Editor for my XSD.
XML Document:
<?xml version="1.0"?><batch xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <batchId>b1</batchId> <rec> <messageId>m1</messageId> <data>foo</hl7_data> </rec> <rec> <messageId>m2</messageId> <data>bar</data> </rec></batch>
Exception Details:
System.InvalidOperationException: There is an error in the XML document. ---> System.InvalidOperationException: <messageId> was not expected.at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderString.Read2_string()--- End of inner exception stack trace ---at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, XmlDeserializationEvents events)at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)at Microsoft.XLANGs.Core.Part.XPathLoad(Part sourcePart, String xpath, Type dstType)at DSSI.ReadyMed.PatientPayer.PCC.ServiceOrchestration.segment2(StopConditions stopOn)at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
I searched for other posts with no luck. Any assistance would be appreciated.
Thank you,--Marcin Polewski
I figured out my problem. The XPath query need to have a surrounded "string()" function call as follows:
string(/*[local-name()='batch']/*[local-name()='rec'][position()='1']/*[local-name()='messageId'])
P.S. This site is great!
Thanks,--Marcin