You must Sign In to post a response.
  • Category: BizTalk

    Exacting element from xml string format

    hi

    my requirement is to call the send a request message to the webservice and gets response in the string format and i have to transform this received message from webservice to another message.

    how can i extract elements from the response from the webservice message as it is in string format.

    i think i have to use xpath,

    but please help me with example thanks in advance.

    i will show the response message which i got from webservice



    <?xml version="1.0" encoding="utf-8"?>
    <GetDataResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://data.bicii.l.acc.com">
    <errorDescription xsi:nil="true" xmlns="" />
    <errorId xsi:nil="true" xmlns="" />
    <errorSource xsi:nil="true" xmlns="" />
    <errorType xsi:nil="true" xmlns="" />
    <redirectionUrl xsi:nil="true" xmlns="" />
    <status xmlns="">0</status>
    <statusCode xmlns="">OK</statusCode>
    <strOrder xmlns=""><Order xmlns="urn:www.nobentus.com/Acc/ois"><Messages><Message MsgID="eBookOrder"><Record RecID="Orders"><Record RecID="Order"><OrderDate>2010-01-26 04:20:24.0</OrderDate><CustomerIdentifier>0248590700</CustomerIdentifier><CustomerOrderNumber>EB40700</CustomerOrderNumber><CustomerOrderDate>2010-02-26 04:20:24.0</CustomerOrderDate><PartDeliveryAccepted>1</PartDeliveryAccepted><MeansOfTrp>301</MeansOfTrp><GoodsMarking>Goods mark: EB40700</GoodsMarking><FreeTextOnTradeDocuments>gem. Unterschriftenregelung OK.</FreeTextOnTradeDocuments><OrderType>Normal</OrderType><HandledBy>CSR</HandledBy><TermsOfPayment>104</TermsOfPayment><TermsOfDelivery>Freight carriage. Insurance to destination (CIP)</TermsOfDelivery><IndustryCode>FOU</IndustryCode><ModeOfPayment>FUL</ModeOfPayment><Application>PC1</Application><Channel>GIND</Channel><PlacedBy>Hewa Rau</PlacedBy><AdditionalSalesPerson1>christian.eickhorst@de.abb.com</AdditionalSalesPerson1><AdditionalSalesPerson1Email>christian.eickhorst@de.abb.com</AdditionalSalesPerson1Email><Record RecID="HeaderDelAdr"><Name1>Herzog Maschinenfabrik GmbH &amp; Co.</Name1><Road1>Gehren 1</Road1><PostCode>49086</PostCode><Town>Osnabrück</Town><Country>DE</Country><ContactPerson>-</ContactPerson><EMail>changeit@in.acc.com</EMail></Record><Record RecID="HeaderInvAdr"><Name1>sanfranisrik GmbH &amp; Co.</Name1><Road1> Gehren 1</Road1><PostCode>49086</PostCode><Town>Osnabrück</Town><Country>italy</Country><Phone>-</Phone><EMail>changeit@in.acc.com</EMail></Record></Record></Record></Message></Messages></Order></strOrder>
    </GetDataResponse>

    Thanks in advance , please help me out
  • #566250
    XmlDocument doc = new XmlDocument();
    doc.LoadXml("<WebServiceOutput/>");
    XmlNodeList nodeList = doc.documentElement.selectNodes("//GetDataResponse/strOrder/Order");


    Now you have to iterate nodeList one by one.


    Sathiya.R

  • #566279
    if you are working in .net 3.5 then i suggest to use LINQ in order to read the xml file.
    please refer below link for sample code
    http://www.dotnetobject.com/showthread.php?tid=661

    _______________________________
    Nisar Ahmad
    DotNetSpider MVM, Badge of Appreciation Award – 2010
    Greatness Can't be achieved by doing big things, If you really want to be great, Do small things in Great way.

  • #567454
    I have tried what u said using xnodelist, but in the expression shape it showing error,
    one more thing i am getting response message in the whole message only strOrder is in the string format, i want to map the elements present in the Order node, to another schema,

    pls help me out


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.