Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web service return types

Status
Not open for further replies.

ColinGregory

Technical User
Feb 16, 2001
39
US
Hello

Just teaching myself webservices . . .

Can somebody please help me out and answer the following. I'm trying to access a free webservice which publishes movie times for your area. I've created the proxy ok in VWD Express 2008. The following code appears in my reference.cs file.

What I don't understand is what is the object/variable/data type that is being returned and how do I get at the result of the function?


Code:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("[URL unfurl="true"]http://www.ignyte.com/whatsshowing/GetUpcomingMovies",[/URL] RequestNamespace="[URL unfurl="true"]http://www.ignyte.com/whatsshowing",[/URL] ResponseNamespace="[URL unfurl="true"]http://www.ignyte.com/whatsshowing",[/URL] Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public UpcomingMovie[] GetUpcomingMovies(int month, int year) {
            object[] results = this.Invoke("GetUpcomingMovies", new object[] {
                        month,
                        year});
            return ((UpcomingMovie[])(results[0]));
        }

Heres my creation of the proxy class (where movieTimes is the name of my web reference)

Code:
movieTimes.MovieInformation mtProxy = new movieTimes.MovieInformation();

Many thanks for your time
 
I don't see how [tt]return ((UpcomingMovie[])(results[0]));[/tt] will work. the result of a webservice is either xml or json. in either case you cannot simply cast from a string (xml/json) to a typed object. you need to parse the result to the type you want.

in this case you need to parse a string to an array of UpcommingMovie objects.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top