At some point you’re going to find it useful to return a few different values at a time. The best way to do this is to actually create an object that will contain all the values that you will need to return and then pass that back as the return value.

For example, in the screenshot above, I’ve created a small class that initializes it’s public variables and then returns that newly created object. Once we look at the resultant XML, it will be clear what happened.
Picture
And then when we test the web service, the following XML is returned. Notice that the XML node names correspond to the names of the variables in the object that was returned.

But next, we’re going to look at how to actually use all of this XML data. Please, please, please don’t just create XML parsers. You need to be code generating and Microsoft has made generating code for web services incredibly easy if you’re using one of their .NET technologies. If you’re not, I have no idea what you do then but let’s assume we’re not in that predicament.
Subscribe to
Posts [Atom]