Return XDocument from service
i have web service:
[webmethod]public xdocument loaddata(string path){
stringbuilder resturl = new stringbuilder(); httpwebrequest restrequest; httpwebresponse restresponse;resturl.appendformat(path);
restrequest = (httpwebrequest)webrequest.create(resturl.tostring());restrequest.headers.add(
"authorization", "basic " + convert.tobase64string(encoding.ascii.getbytes("demo:demo"))); restresponse = (httpwebresponse)restrequest.getresponse(); stream stream = restresponse.getresponsestream(); xmlreader reader = xmlreader.create(stream); xdocument xdoc = xdocument.load(reader); return xdoc;}
but when try view in browser (.asmx) shows me following error:system.xml.linq.xdeclaration cannot serialized because not have parameterless constructor
what should overcome it? constructor should be? don't return custom class - xdoc - variable.
try using xmldocument system.xml instead of xdocument.
Silverlight > Programming Silverlight with .NET – General
Comments
Post a Comment