Last post Feb 23, 2021 03:54 AM by yij sun
None
0 Points
84 Posts
Feb 22, 2021 08:21 AM|20141113|LINK
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <soap:Body> <RequestData xmlns="http://tempuri.org/"> <ID></ID> <Reference>TEST0222</Reference> <DetailsObject> <![CDATA[ <DetailsObject> <A1>Party</A1> <CustomerType>P</CustomerType> <Gender>M</Gender> <Customers> <Name>Amy</Name> <Name>Billy</Name> </Customers> <NativeNames> <NativeName/> </NativeNames> <Countries> <Country>BANGLADESH</Country> </Countries> </DetailsObject> ]]> </DetailsObject>
in DetailsObject field, there is <Countries>, which may contain 1 or multiple <Country> element inside <Countries> field.
how can i know the data of <DetailsObject> and data type of <Countries> in <DetailsObject> in document.
Contributor
3730 Points
1427 Posts
Feb 23, 2021 03:54 AM|yij sun|LINK
Hi 20141113,
According to your description, I suggest you could refer to the following code to parse SOAP format xml file.
string xml = Server.MapPath("SOAPFile.xml"); XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(xml); XmlNamespaceManager xnm = new XmlNamespaceManager(xmldoc.NameTable); xnm.AddNamespace("SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/"); xnm.AddNamespace("Mo", "http://www.monternet.com/dsmp/schemas/"); XmlNodeList lst = xmldoc.SelectNodes("//SOAP-ENV:Header/Mo:TransactionID", xnm); StringBuilder sb = new StringBuilder(); for (int i = 0; i < lst.Count; i++) { XmlNode node = lst[i]; XmlElement ele = (XmlElement)node; sb.AppendLine(ele.Name + ":" + ele.InnerText); sb.AppendLine("<br />"); }
More details,you could refer to below article:
https://forums.asp.net/t/2067034.aspx?How+do+i+parse+SOAP+formed+XML
Best regards,
Yijing Sun
None
0 Points
84 Posts
web service data type
Feb 22, 2021 08:21 AM|20141113|LINK
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<soap:Body>
<RequestData xmlns="http://tempuri.org/">
<ID></ID>
<Reference>TEST0222</Reference>
<DetailsObject>
<![CDATA[
<DetailsObject>
<A1>Party</A1>
<CustomerType>P</CustomerType>
<Gender>M</Gender>
<Customers>
<Name>Amy</Name>
<Name>Billy</Name>
</Customers>
<NativeNames>
<NativeName/>
</NativeNames>
<Countries>
<Country>BANGLADESH</Country>
</Countries>
</DetailsObject>
]]>
</DetailsObject>
in DetailsObject field, there is <Countries>, which may contain 1 or multiple <Country> element inside <Countries> field.
how can i know the data of <DetailsObject> and data type of <Countries> in <DetailsObject> in document.
Contributor
3730 Points
1427 Posts
Re: web service data type
Feb 23, 2021 03:54 AM|yij sun|LINK
Hi 20141113,
According to your description, I suggest you could refer to the following code to parse SOAP format xml file.
More details,you could refer to below article:
https://forums.asp.net/t/2067034.aspx?How+do+i+parse+SOAP+formed+XML
Best regards,
Yijing Sun