XPath function to assign an XPath value to a message part, or to assign a value to an XPath that refers to a message part. We can use xpath function in both BizTalk shape either in message assignment or in expression shape.
Now let us describe how set XPath value and same get value by using XPath-
1. How set value by using XPath
xpath(msgGetInputMessage,"/*[local-name()='procLoadFile' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo']/*[local-name()='Data' and namespace-uri()='http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo']") = varXmlData;
2. How get value by using XPath
varFileName = xpath(msgOutputMessage,"/*[local-name()='Request' and namespace-uri()='http://TestBizBAM3.Request']/*[local-name()='Header' and namespace-uri()='http://TestBizBAM3.Request']/*[local-name()='ReqID' and namespace-uri()='http://TestBizBAM3.Request']");
Some more XPath important point just for your awareness:
I. Do not use XPath for repeating tag either it is element or attribute
II. How get Instance XPath query either from attribute or element
> Open Schema in Visual Studio and click on element or attribute(as per your requirement)
> See the property window and complete copy from Instance XPath (as above in my picture of XPath)
III. To avoid data conversion error so better way to retrieve value using xpath function always use datatype i.e string, number etc.-
I. Do not use XPath for repeating tag either it is element or attribute
II. How get Instance XPath query either from attribute or element
> Open Schema in Visual Studio and click on element or attribute(as per your requirement)
> See the property window and complete copy from Instance XPath (as above in my picture of XPath)
III. To avoid data conversion error so better way to retrieve value using xpath function always use datatype i.e string, number etc.-
varFileName = xpath(msgOutputMessage,"string(xpath query)");
varFileSize = xpath(msgOutputMessage,"number(xpath query)");
varRecordsCount = xpath(msgOutputMessage,"count(copy xpath node value from schema)");
Comments
Post a Comment
Please write comment only that belongs to this blog