xmlns=''> was not expected. - There is an error in XML document (2, 2)

user1384603 picture user1384603 · Oct 1, 2012 · Viewed 44.5k times · Source

Im trying to deserialize the response from this simple web service

Im using the following code:

WebRequest request = WebRequest.Create("http://inb374.jelastic.tsukaeru.net:8080/VodafoneDB/webresources/vodafone/04111111");    
WebResponse ws = request.GetResponse();
XmlSerializer s = new XmlSerializer(typeof(string));
string reponse = (string)s.Deserialize(ws.GetResponseStream());

Answer

L.B picture L.B · Oct 1, 2012

Declaring XmlSerializer as

XmlSerializer s = new XmlSerializer(typeof(string),new XmlRootAttribute("response"));

is enough.