Search Results

Search found 2 results on 1 pages for 'jlo'.

Page 1/1 | 1 

  • C# How can I return my base class in a webservice

    - by HenriM
    I have a class Car and a derived SportsCar: Car Something like this: public class Car { public int TopSpeed{ get; set; } } public class SportsCar : Car { public string GirlFriend { get; set; } } I have a webservice with methods returning Cars i.e: [WebMethod] public Car GetCar() { return new Car() { TopSpeed = 100 }; } It returns: <Car> <TopSpeed>100</TopSpeed> </Car> I have another method that also returns cars like this: [WebMethod] public Car GetMyCar() { Car mycar = new SportsCar() { GirlFriend = "JLo", TopSpeed = 300 }; return mycar; } It compiles fine and everything, but when invoking it I get: System.InvalidOperationException: There was an error generating the XML document. --- System.InvalidOperationException: The type wsBaseDerived.SportsCar was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically. I find it strange that it can't serialize this as a straight car, as mycar is a car. Adding XmlInclude on the WebMethod of ourse removes the error: [WebMethod] [XmlInclude(typeof(SportsCar))] public Car GetMyCar() { Car mycar = new SportsCar() { GirlFriend = "JLo", TopSpeed = 300 }; return mycar; } and it now returns: <Car xsi:type="SportsCar"> <TopSpeed>300</TopSpeed> <GirlFriend>JLo</GirlFriend> </Car> But I really want the base class returned, without the extra properties etc from the derived class. Is that at all possible without creating mappers etc? Please say yes ;)

    Read the article

  • cross domain gwt ?

    - by jlo
    is there a way to run gwt on a proxy loaded web page ? ex) using proxy script on myexamplesite.com that loads finance.google.com, and running GWT on the newly loaded page. I've been doing the above before I found about GWT, using LAMP stack + Jquery (UI), which quickly turned out to be crap and inefficient. All this trouble to bypass browser's default Single Origin Policy. So, right now, is it possible to overcome this problem with GWT ? Is it possible to some how, run javascript on a html page from finance.google.com loaded into myexamplesite.com's frame with GWT or other solution? I am not looking to do JSON or RSS related topics. What I need is high lighted in bold. Is GWT + Gears what I should be using ? Thank you.

    Read the article

1