我想从 获取数据NetSuite WebService。这就是我的代码的样子:
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;
}
}
变量中存在两个节点res。这是第一个节点的样子:
<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:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
这就是我的第二个节点的样子:
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" />
如果响应中存在数据,则它们存在于第二个节点中。如果数据不存在,我想获取第一个节点元素name内的属性值。xs:sequence
皈依舞
红颜莎娜
相关分类