Home Page › Forums › BizTalk 2004 – BizTalk 2010 › xPath and distinguished fields not working
- This topic has 6 replies, 1 voice, and was last updated 9 years, 1 month ago by
community-content.
-
AuthorPosts
-
-
August 29, 2009 at 7:05 AM #23151
Dear All,
I have spent a couple days on this problem with no resolution, I just need to retrieve the value of an element in one of my orchestrations, I have done this in other projects in the solution with xpath by doing this and this is what I am doing
CurrentDateString = System.Convert.ToString(xpath(BankRefundCutOffRQ, “string(/*[local-name()=’SADAD’ and namespace-uri()=”]/*[local-name()=’BankSvcRq’ and namespace-uri()=”]/*[local-name()=’BankRefundCutOffRq’ and namespace-uri()=”]/*[local-name()=’PrcDt’ and namespace-uri()=”])”));
I don’t understand why it works in other projects with other messages and not here, I copied the namespace and path from the schema by clicking on the element itself.
I also tried to distinguish the field and call it using (I converted to string because the element is defined as DateTime)
CurrentDateString = System.Convert.ToString(BankRefundCutOffRQ.BankSvcRq.BankRefundCutOffRq.PrcDt);
the funny thing is this call to count the same element which I am trying to retreive returns the correct value (returns 1)
recordCount = System.Convert.ToString(xpath(BankRefundCutOffRQ, “count(/*[local-name()=’SADAD’ and namespace-uri()=”]/*[local-name()=’BankSvcRq’ and namespace-uri()=”]/*[local-name()=’BankRefundCutOffRq’ and namespace-uri()=”]/*[local-name()=’PrcDt’ and namespace-uri()=”])”));
at one point I thought maybe I had a missing assembly reference, I checked the other projects and they reference Microsoft.BizTalk.GlobalPropertySchemas
so I added that to my project with no luck..Please HELP! I can’t believe so much time was wasted on this silly problem
My XML message I am using looks like this
– <SADAD>
<ClientDt>2009-08-22T12:28:53</ClientDt><Sender>001</Sender><Receiver>RI</Receiver><MsgCode>RCUTRQ</MsgCode></SignonProfile></SignonRq></SADAD>Finally here is the error I got, I get the same exact error no mater if I use xpath or the distinguished fieldsDescription:
Uncaught exception (see the ‘inner exception’ below) has suspended an instance of service ‘MOI.MOI_BankRefundCutoffOrcn(06eed797-301b-d3ce-fa5f-311542544d0b)’.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: 7f335f72-eccf-463f-bedb-5154f82e0722
Shape name: Construct Date
ShapeId: 804d2a5d-f34f-42fa-acf5-cc60d56665a5
Exception thrown from: segment 1, progress 58
Inner exception: Object reference not set to an instance of an object.
Exception type: NullReferenceException
Source: Microsoft.XLANGs.Engine
Target Site: System.Object XPathLoad(Microsoft.XLANGs.Core.Part, System.String, System.Type)
The following is a stack trace that identifies the location where the exception occuredat Microsoft.XLANGs.Core.Part.XPathLoad(Part sourcePart, String xpath, Type dstType)
at MOI.MOI_BankRefundCutoffOrcn.segment1(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp) -
August 29, 2009 at 2:59 PM #23154
Hi,
You have a message instance that is not initialized in a Message Assignment shape in your orchestration. Your error description pretty much points that out:
“Shape name: Construct Date…
Exception thrown from: segment 1, progress 58
Inner exception: Object reference not set to an instance of an object.
Exception type: NullReferenceException
Source: Microsoft.XLANGs.Engine”Instantiate your message properly and that should fix your problem.
Daniel.
-
August 30, 2009 at 2:37 AM #23156
Hi xman,
sorry not so obvious to me, can you tell me what I need to do? Thanks
-
August 31, 2009 at 9:06 PM #23173
*sigh*
You have an error in your orchestration, in a shape named Construct Date. Do you understand that? You have a message that is not properly initialized in that shape: taking care of that will fix your error.
-
September 17, 2009 at 5:47 AM #23264
Hello, i have the same problem and my question is: what is the right way to initialize the message??
-
September 17, 2009 at 7:54 AM #23268
Hi,
To initialize your message, declare a variable of type XmlDocument and load it with XML contents that conform to the schema of your message, let’s say something like the following (this is generic, by the way):
<ns0:TopNode xmlns:ns0=”Namespace”>
<ns0:Element1>SomeValue</ns0:Element1>
</ns0:TopNode>Then assign that variable to your message in a Message Assignment shape to initialize your message.
-
February 22, 2010 at 11:59 AM #24267
Hi
For those who are getting there XML from a stored procedure , they might have used
Select XYZ FROM XYZ FOR XML AUTO, ELEMENTS , XMLDATA
to generate the XML output for the SQL stored procedure to return value
Dont forget to comment XMLDATA in the stored procedure to solve this problem in cause ur using SP
-
-
-
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.