开发者

Name Conflict? 'System.Array' does not contain a definition for 'item'

I am using a webservice (provided by webservices.nl) to extract company data depending on a company number.

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 underlines only "item" in curly red line Error/ 'System.Array' does not contain a definition for 'item' and no extension method 'item' accepting a first argument of type 'System.Array' could be found (are you missing a using directive or an assembly reference?)

So the problem is that intellisense doesn't recognize item and also streetname. When I take something else from that message, it works :

 string page = result.paging.curpage;

the response soap message looks like this:

<?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>
</bus开发者_JS百科inessGetDossierV3Response>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Is this a name conflit problem ? If yes, how can I resolve it ? If not, how can i extract the data in the results part?


I think item is a placeholder for the array indexer so you probably want to put:

string address = result.results[ 0 ].EstablishmentPostcode;


The service is returning an array of results instead of a single result. Use this instead:

string address = result.results[0].EstablishmentPostcode;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜