Lee Redhead

Lee Redhead

  • NA
  • 1
  • 1.6k

Returning values from web service

Feb 4 2011 1:41 PM

Hello,
I am quite stuck at the moment with trying to return data from a Web Service. I am ok with returning the data from the inital part and assigning the values to for labels and variables however I am stuck at returning some other data from the same set.
The structure is as follows:
<getVehicleWithOptionsResult>
        <VehicleId>string</VehicleId>
        <Chassis>string</Chassis>
        <Engine>string</Engine>
        <Description>string</Description>
        <RegistrationDate>dateTime</RegistrationDate>
        <RegistrationMark>string</RegistrationMark>
        <Options>
          <VehicleOption>
            <VehicleId>string</VehicleId>
            <Code>string</Code>
            <Description>string</Description>
            <Type>string</Type>
            <Category>string</Category>
            <UpdatedOn>dateTime</UpdatedOn>
            <ListPrice>decimal</ListPrice>
            <Quantity>int</Quantity>
          </VehicleOption>
          <VehicleOption>
            <VehicleId>string</VehicleId>
            <Code>string</Code>
            <Description>string</Description>
            <Type>string</Type>
            <Category>string</Category>
            <UpdatedOn>dateTime</UpdatedOn>
            <ListPrice>decimal</ListPrice>
            <Quantity>int</Quantity>
          </VehicleOption>
        </Options>
</getVehicleWithOptionsResult>
 
The search for the web service uses the VehicleID to perform the lookup which is working fine, the first field I return is the RegDate which I do as follows:
string
chassisNumber;
vehicleID= VehicleID.Text;

VehicleSearch.
VehicleService vd = new VehicleSearch.VehicleService();
RegDate.Text =
Convert.ToString(vd.getVehicleWithOptions(vehicleID).RegistrationDate);
 
And that works for all the fields that are in the first level of the data, however I also need to extract data from the <Options> section, the CODE field specifically.
I am really struggling to work out how to do this. Basically I need to perform a search on all the options to find if certian CODES exisit, also other contitions such as Type and Category need to be met but they are the same for all options I am interested in.
How best to do this? I have nevre worked with XML Web Services before and am really stuck trying to work this out.
If you need any more information let me know,
Lee
 
 

Answers (2)