getting datas from XML : NetSuite WebService

closed account (9j26pfjN)
I want to get data from NetSuite WebService . This is how my code looks like:

public class HomeController : Controller
{
WebServiceGenesisSoapClient service;
public HomeController()
{
var aa = WebServiceGenesisSoapClient.EndpointConfiguration.WebServiceGenesisSoap;
service = new WebServiceGenesisSoapClient(aa);
}
public async Task<IActionResult> Index()
{

WebServiceGenesisSoapClient client = new WebServiceGenesisSoapClient(aa, "http://82.71.28.125/WebServiceGenesis/WebServiceGenesis.asmx");

GetStockQuantityArrayRequest getStockQuantityArrayRequest = new GetStockQuantityArrayRequest();
var stocklist = client.GetStockQuantityArrayAsync(getStockQuantityArrayRequest).Result;
ArrayOfXElement res = stocklist.GetStockQuantityArrayResult;
}
}

Two Nodes are present in res variable. This is how first node looks like:

<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="StockQuantityArray">
<xs:complexType>
<xs:sequence>
<xs:element name="Colour" type="xs:string" minOccurs="0" />
<xs:element name="Quantity1" type="xs:int" minOccurs="0" />
<xs:element name="Quantity2" type="xs:int" minOccurs="0" />
<xs:element name="Quantity3" type="xs:int" minOccurs="0" />
<xs:element name="Quantity4" type="xs:int" minOccurs="0" />
<xs:element name="Quantity5" type="xs:int" minOccurs="0" />
<xs:element name="Quantity6" type="xs:int" minOccurs="0" />
<xs:element name="Quantity7" type="xs:int" minOccurs="0" />
<xs:element name="Quantity8" type="xs:int" minOccurs="0" />
<xs:element name="Quantity9" type="xs:int" minOccurs="0" />
<xs:element name="Quantity10" type="xs:int" minOccurs="0" />
<xs:element name="Quantity11" type="xs:int" minOccurs="0" />
<xs:element name="Quantity12" type="xs:int" minOccurs="0" />
<xs:element name="Quantity13" type="xs:int" minOccurs="0" />
<xs:element name="Quantity14" type="xs:int" minOccurs="0" />
<xs:element name="Quantity15" type="xs:int" minOccurs="0" />
<xs:element name="Quantity16" type="xs:int" minOccurs="0" />
<xs:element name="Quantity17" type="xs:int" minOccurs="0" />
<xs:element name="Quantity18" type="xs:int" minOccurs="0" />
<xs:element name="Quantity19" type="xs:int" minOccurs="0" />
<xs:element name="Quantity20" type="xs:int" minOccurs="0" />
<xs:element name="Quantity21" type="xs:int" minOccurs="0" />
<xs:element name="Quantity22" type="xs:int" minOccurs="0" />
<xs:element name="Quantity23" type="xs:int" minOccurs="0" />
<xs:element name="Quantity24" type="xs:int" minOccurs="0" />
<xs:element name="Quantity25" type="xs:int" minOccurs="0" />
<xs:element name="Quantity26" type="xs:int" minOccurs="0" />
<xs:element name="Quantity27" type="xs:int" minOccurs="0" />
<xs:element name="Quantity28" type="xs:int" minOccurs="0" />
<xs:element name="Quantity29" type="xs:int" minOccurs="0" />
<xs:element name="Quantity30" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>

This is how my second node looks like :

<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" />

If datas are present in response, they are present in second node. If datas are not present, I want to get value of name attribute inside xs:sequence element of first node.
Topic archived. No new replies allowed.