trying to read data in xml element

  Kiến thức lập trình

I have below xml

<soap:Envelope 
    xmlns:soap="http://www.w3.org/2003/05/soap-envelope" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
    xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope">
        <wsa:Action>http://cdr.ffiec.gov/public/services/RetrieveFacsimileResponse</wsa:Action>
        <wsa:MessageID>urn:uuid:f1c95072-c1ab-44f4-9c8f-59a26e28fce8</wsa:MessageID>
        <wsa:RelatesTo>urn:uuid:0f4a548e-39ad-4b5f-be02-ad9eaae75e32</wsa:RelatesTo>
        <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
        <wsse:Security>
            <wsu:Timestamp wsu:Id="Timestamp-ee96d970-c821-455d-9f92-75085fcad001">
            <wsu:Created>2024-06-10T20:27:43Z</wsu:Created>
            <wsu:Expires>2024-06-10T20:32:43Z</wsu:Expires>
            </wsu:Timestamp>
        </wsse:Security>
    </env:Header>
    <soap:Body>
        <RetrieveFacsimileResponse xmlns="http://cdr.ffiec.gov/public/services">
            <RetrieveFacsimileResult>TestData==</RetrieveFacsimileResult>
        </RetrieveFacsimileResponse>
    </soap:Body>
</soap:Envelope>

I am trying to read the data inside RetrieveFacsimileResult like this.

XmlDocument MyDoc = new XmlDocument(); 
MyDoc.LoadXml(response.Content);
XmlNode MyNode = MyDoc.SelectSingleNode("xml/soap:Envelope/soap:Body/RetrieveFacsimileResponse/RetrieveFacsimileResult");

I am getting Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.

How to read the data inside RetrieveFacsimileResult??

LEAVE A COMMENT