I am creating a .net core web api method to get the data from xml file based on request. The data is from soap service. Below is request Parameter. So i am searching based on the request parameter.(producer code)
Request------>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:get="http://xyz/business/profile_management_ebe4x1">
<soapenv:Header/>
<soapenv:Body>
<get:GetProducerInfo>
<!--Optional:-->
<GetProducerInfoRequest>
<ProducerCode>IT9559</ProducerCode>
</GetProducerInfoRequest>
</get:GetProducerInfo>
</soapenv:Body>
</soapenv:Envelope>
Below is the response i am looking Response------->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<dlwmin:GetProducerInfoResponse xmlns:dlwmin="http://xyz/business/Profile_management_ebe4x1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<GetProducerInfoReply xmlns:ns2="http://xyz/get_access/producer_info" xmlns:ns3="http://yzy/business/profile_reply_ebe4x1">
<Producer>
<ProducerName>MARSH & ABC company</ProducerName>
<ResidentState>TEXAS</ResidentState>
<ResidentCity>MIDLAND</ResidentCity>
<ProducerStatus>Open</ProducerStatus>
<ProducerCode>IT6372</ProducerCode>
<MasterCode>272495</MasterCode>
<NationalCode>174144</NationalCode>
<ProducingBranchCode>ABO</ProducingBranchCode>
<CategoryCode>INT</CategoryCode>
</Producer>
<Producer>
<ProducerName>MARSH & ABC company </ProducerName>
<ResidentState>MICHIGAN</ResidentState>
<ResidentCity>LIVONIA</ResidentCity>
<ProducerStatus>Open</ProducerStatus>
<ProducerCode>IT9559</ProducerCode>
<MasterCode>IT9559</MasterCode>
<NationalCode>174144</NationalCode>
<LegacyCode>0036604-99999</LegacyCode>
<ProducingBranchCode>MBO</ProducingBranchCode>
<CategoryCode>GEN</CategoryCode>
</Producer>
I have created xml file in .net solution
XDocument xdoc = XDocument.Load(Path.Combine(Directory.GetCurrentDirectory(), "ProducerResponse.xml"));
XNamespace ns = "http://xyz/get_access/producer_info";
how i can start read from producer node on request.<producer>
always does not not contain equal data. some time it contains 9 or 10. data as it looking from the above data.
TIA