xPath and distinguished fields not working

Home Page Forums BizTalk 2004 – BizTalk 2010 xPath and distinguished fields not working

Viewing 1 reply thread
  • Author
    Posts
    • #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>

      <SignonRq>
        <ClientDt>2009-08-22T12:28:53</ClientDt>
      <SignonProfile>
        <Sender>001</Sender>
        <Receiver>RI</Receiver>
        <MsgCode>RCUTRQ</MsgCode>
        </SignonProfile>
        </SignonRq>
      <BankSvcRq>
      <Status>
        <StatusCode>0</StatusCode>
        <ShortDesc>Success</ShortDesc>
        <Severity>Info</Severity>
        </Status>
        <RqUID>71B82E65-F40B-30EC-E043-0A10113730EC</RqUID>
      <BankRefundCutOffRq>
        <PrcDt>2009-08-21T00:00:00</PrcDt>
        </BankRefundCutOffRq>
        </BankSvcRq>
        </SADAD>
      Finally here is the error I got, I get the same exact error no mater if I use xpath or the distinguished fields
      Description:
      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 occured
         at 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)
    • #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.

      • #23156

        Hi xman,

        sorry not so obvious to me, can you tell me what I need to do? Thanks

         

        • #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.

           

          • #23264

            Hello, i have the same problem and my question is: what is the right way to initialize the message??

            • #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.

               

              • #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

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.