none
set a value to repeated elements using xpath at orchestration

    Question

  • I am tring following xpath expression to assign value to repeated elements

    xpath(msgAxaptaToDyn._nsy_CreateSalesOrder,/*[local-name()='Nsy_CreateSalesOrder' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Nsy_CreateSalesOrder']/*[local-name()='NSY_SalesTable_1' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Nsy_CreateSalesOrder']/*[local-name()='NSY_SalesLine_1' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Nsy_CreateSalesOrder']/*[local-name()='MessageID' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Nsy_CreateSalesOrder'])="sssss";

     

    but it showing following error

     

    xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'NORSKSynergi.EDIOrdersToAxapta.SyncOrder(35e87d47-5552-c0fa-8f7b-199da78925d5)'.
    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: 6cfc427c-2849-4d0d-adec-9b508b9bcb4e
    Shape name: ConstructMessage_AxaptatoDyn
    ShapeId: ec55c95c-df07-4d45-ad4f-f43ed12a9253
    Exception thrown from: segment 1, progress 16
    Inner exception: The XPath expression '/*[local-name()='Nsy_CreateSalesOrder' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Nsy_CreateSalesOrder']/*[local-name()='NSY_SalesTable_1' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Nsy_CreateSalesOrder']/*[local-name()='NSY_SalesLine_1' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Nsy_CreateSalesOrder']/*[local-name()='MessageID' and namespace-uri()='http://schemas.microsoft.com/dynamics/2008/01/documents/Nsy_CreateSalesOrder']' selected a node which is not valid for property or distinguished field retrieval, or it selected no node at all. Only text-only elements or attributes may be selected.
           
    Exception type: XPathSelectionException
    Source: Microsoft.XLANGs.Engine
    Target Site: Void XPathStore(System.Object, System.String)
    The following is a stack trace that identifies the location where the exception occured

       at Microsoft.XLANGs.Core.Part.XPathStore(Object rValue, String xpath)
       at NORSKSynergi.EDIOrdersToAxapta.SyncOrder.segment1(StopConditions stopOn)
       at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)

           

    Tuesday, November 29, 2011 7:31 AM

Answers

  • This can be done in orchestration using map&custom xsl file(for-each,if) .
    Srikanth Peddy. MCTS-BizTalk Server Please mark as answered .
    Tuesday, November 29, 2011 11:46 AM

All replies

  • If your xpath is returning multiple nodes then it will not work as you cannot update a node-set this way.

    What you can do is

    1) inside the orchestration use xpath to count the number of elements, then using looping shape you can access and update each one of them by using xpath and specifying the exact location

    nodesCount = xpath(message,'count(/*[local-name()='node1] /*[local-name()='node2])')

    currentIndex = 1

    for 1 to nodesCount

          xpath(message,'/*[local-name()='node1] /*[local-name()='node2]['+currentIndex+']/*[local-name()='MessageID']

          currentIndex =  currentIndex + 1

    2) make this update in a a c# helper class

     

    Tuesday, November 29, 2011 9:19 AM
  • This can be done in orchestration using map&custom xsl file(for-each,if) .
    Srikanth Peddy. MCTS-BizTalk Server Please mark as answered .
    Tuesday, November 29, 2011 11:46 AM
  • There is another scenario where if the filed is not present then you will get this error. If it is not a repeating element, then make sure in your map this particular filed is marked as "Empty" in the value property or have a string contenation functoid and connect to this element. The string functoid can be empty.

     

    Thanks


    SKGuru
    Tuesday, November 29, 2011 1:32 PM
  • how to wite the helper class?

    plz help

    Thursday, August 08, 2013 11:32 AM
  • Hi,

    How to write Helper class:

    http://social.technet.microsoft.com/wiki/contents/articles/6977.biztalk-server-2010-net-helper-classes.aspx


    I hope this helps!!!!!! Please mark as Helpful. If this answers your question, please mark it as "Answered". It will help to reduce visits to same post as it's already answered and will help guys with same question as yours without even posting it . Maheshkumar S. Tiwari|Team lead/Consultant(EDI/EAI)|iVision Software Pvt Ltd, Pune.

    Thursday, August 08, 2013 11:46 AM