我正在使用网络服务(由webservices.nl提供)根据公司编号提取公司数据。
myserviceBusiness = new nl.webservices.ws1.Webservicesnl();
nl.webservices.ws1.BusinessDossierV3PagedResult result = null;
result = myserviceBusiness.businessGetDossierV3(KVKnr, "0000", 1);
string address = result.results.item.EstablishmentPostcode;
VS仅在红色虚线中为“item”加下划线 错误/'System.Array'不包含'item'的定义,并且没有可以找到接受类型'System.Array'的第一个参数的扩展方法'item'(你是否缺少using指令或程序集引用?)
所以问题是intellisense不识别项目和街道名称。 当我从该消息中获取其他内容时,它可以工作:
string page = result.paging.curpage;
响应肥皂消息如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<businessGetDossierV3Response xmlns="http://www.webservices.nl/soap/">
<out>
<paging>
<curpage>1</curpage>
<perpage>10</perpage>
<numpages>1</numpages>
<numresults>1</numresults>
<maxresults>100</maxresults>
</paging>
<results>
<item>
<RegisterLetter>H</RegisterLetter>
<DossierNo>50085980</DossierNo>
<SubDossierNo>0000</SubDossierNo>
<ChamberNo></ChamberNo>
<Legalformcode></Legalformcode>
<LegalformcodeText></LegalformcodeText>
<Tradename45></Tradename45>
<TradenameFull></TradenameFull>
<EstablishmentPostcode></EstablishmentPostcode>
<EstablishmentCity></EstablishmentCity>
<EstablishmentStreetname></EstablishmentStreetname>
<EstablishmentHouseNo></EstablishmentHouseNo>
<CorrespondencePostcode></CorrespondencePostcode>
<CorrespondenceCity></CorrespondenceCity>
<CorrespondenceStreetname></CorrespondenceStreetname>
<CorrespondenceHouseNo>97</CorrespondenceHouseNo>
</item>
</results>
</out>
</businessGetDossierV3Response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
这是一个名称混淆问题吗?如果是,我该如何解决? 如果没有,我如何在结果部分中提取数据?
答案 0 :(得分:0)
该服务返回结果数组而不是单个结果。请改用:
string address = result.results[0].EstablishmentPostcode;
答案 1 :(得分:0)
我认为item是数组索引器的占位符,因此您可能希望放置:
string address = result.results[ 0 ].EstablishmentPostcode;