none
How to get the nodes from cXML data in c# web api? RRS feed

  • Question


  • Hi every one..!

    this is my cxml file below

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.1.010/cXML.dtd">

    <!-- A request used for copying messages. -->

    -<cXML xml:lang="en" timestamp="1999-03-12T18:39:09-08:00" payloadID="1278@ariba.acme.com">


    -<Header>


    -<From>


    -<Credential domain="NetworkId">

    <Identity>AN01000000001</Identity>

    <!-- Ariba Network -->


    </Credential>

    </From>


    -<To>


    -<Credential domain="NetworkId">

    <Identity>AN0102344440002</Identity>

    <!-- Descartes -->


    </Credential>

    </To>


    -<Sender>


    -<Credential domain="NetworkId">

    <Identity>AN01000000001</Identity>

    <SharedSecret>coyote</SharedSecret>

    <!-- shared secret between Descartes & ACSN -->


    </Credential>

    <UserAgent>ORMS V6.1</UserAgent>

    </Sender>

    </Header>


    -<Request>


    -<CopyRequest>


    -<cXML xml:lang="en-US" timestamp="1999-03-12T18:39:09-08:00" payloadID="456778-200@cxml.workchairs.com">


    -<Header>


    -<From>


    -<Credential domain="NetworkId">

    <Identity>AN01942888711</Identity>

    </Credential>

    </From>


    -<To>


    -<Credential domain="NetworkId">

    <Identity>AN0194283456</Identity>

    </Credential>

    </To>


    -<Sender>


    -<Credential domain="NetworkId">

    <Identity>AN0194288871</Identity>

    <SharedSecret>******</SharedSecret>

    <!-- masked out !-->


    </Credential>

    <UserAgent>Ariba Buyer 7.0</UserAgent>

    </Sender>

    </Header>


    -<Request>


    -<OrderRequest>


    -<OrderRequestHeader type="new" orderDate="1999-03-12" orderID="DO1234">


    -<Total>

    <Money currency="USD">2.68</Money>

    </Total>


    -<ShipTo>


    -<Address>

    <Name xml:lang="en">Acme</Name>


    -<PostalAddress name="default">

    <DeliverTo>Joe Smith</DeliverTo>

    <DeliverTo>Mailstop M-543</DeliverTo>

    <Street>123 Anystreet</Street>

    <City>Sunnyvale</City>

    <State>CA</State>

    <PostalCode>90489</PostalCode>

    <Country isoCountryCode="US">United States</Country>

    </PostalAddress>

    </Address>

    </ShipTo>


    -<BillTo>


    -<Address>

    <Name xml:lang="en">Acme</Name>


    -<PostalAddress name="default">

    <Street>123 Anystreet</Street>

    <City>Sunnyvale</City>

    <State>CA</State>

    <PostalCode>90489</PostalCode>

    <Country isoCountryCode="US">United States</Country>

    </PostalAddress>

    </Address>

    </BillTo>


    -<Tax>

    <Money currency="USD">0.19</Money>

    <Description xml:lang="en">CA Sales Tax</Description>

    </Tax>


    -<Payment>

    <PCard expiration="1999-03-12" number="**********"/>

    <!-- masked out -->


    </Payment>

    <Comments xml:lang="en-US">Anything well formed in XML can go here.</Comments>

    </OrderRequestHeader>


    -<ItemOut requestedDeliveryDate="1999-03-12" quantity="2">


    -<ItemID>

    <SupplierPartID>1233244</SupplierPartID>

    </ItemID>


    -<ItemDetail>


    -<UnitPrice>

    <Money currency="USD">1.34</Money>

    </UnitPrice>

    <Description xml:lang="en">hello</Description>

    <UnitOfMeasure>EA</UnitOfMeasure>

    <Classification domain="SPSC">12345</Classification>

    <ManufacturerPartID>234</ManufacturerPartID>

    <ManufacturerName>foobar</ManufacturerName>

    <URL>www.foo.com</URL>

    </ItemDetail>


    -<Shipping trackingId="1234567890" trackingDomain="FedEx">

    <Money currency="USD">2.5</Money>

    <Description xml:lang="en-us">FedEx 2-day</Description>

    </Shipping>


    -<Distribution>


    -<Accounting name="DistributionCharge">

    <Segment type="G/L Account" description="Entertainment" id="23456"/>

    <Segment type="Cost Center" description="Western Region Sales" id="2323"/>

    </Accounting>


    -<Charge>

    <Money currency="USD">.34</Money>

    </Charge>

    </Distribution>


    -<Distribution>


    -<Accounting name="DistributionCharge">

    <Segment type="G/L Account" description="Travel" id="456"/>

    <Segment type="Cost Center" description="Europe Implementation" id="23"/>

    </Accounting>


    -<Charge>

    <Money currency="USD">1</Money>

    </Charge>

    </Distribution>

    <Comments xml:lang="en-US">Anything well formed in XML can go here.</Comments>

    </ItemOut>

    </OrderRequest>

    </Request>

    </cXML>

    </CopyRequest>

    </Request>

    </cXML>



    this data is posted through the fiddler from body to our http post API,How can we read the node values like payloadID,timestamp etc..in the above cxml and and that all the values need to store into my database..! can you please help me how to get those values from the cxml and mainly i using web api..! from the post method we need to save the data to the database...! can anyone please help me  regarding my question asap!! 

    Thanks in Advance,

    Hemanth.
    • Moved by CoolDadTx Tuesday, May 30, 2017 3:24 PM ASP.NET related
    Friday, May 26, 2017 7:33 AM

All replies


  • Hi Hemanth_K,

    Thank you for posting here.

    According to your question is more related to Web API, I suggest you can go to the Web API forum for suitable support.

    The Visual C# discuss and ask the C# programming language, IDE, libraries, samples and tools.

    Thanks for your understanding and cooperation.

    Best Regards,

    Yohann Lu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 29, 2017 8:46 AM