Reputation: 1985
I have the following webmethod in my application
[WebMethod]
public bool Test(string id)
{
return true;
}
using WebRequest.Create(..) I get the following xml file
<?xml version="1.0" encoding="utf-8"?>
<boolean xmlns="http://tempuri.org/">true</boolean>
and using the following code
XmlSerializer ser = new XmlSerializer(typeof(bool));
var result = (bool)ser.Deserialize(responseStream);
I get the following exception
<boolean xmlns='http://tempuri.org/'> was not expected.
Upvotes: 1
Views: 49
Reputation: 1985
I managed to get it working by doing the following
XmlSerializer serializer = new XmlSerializer(typeof(T), "http://tempuri.org/");
Upvotes: 1