c# - Why Web Service is converting XmlDocument parameter to System.XML.Linq.XElement Parameter -
this question has answer here:
ide: vs 2010 c# .net 4.0
i creating simple web service take xmldocument parameter
public class mywebservice : system.web.services.webservice { public void receivexml(xmldocument xdoc, string strxmlfilename) { xmlreceiver.receive(xdoc, strxmlfilename); } }
when ran service , added projectb using add service reference, , went reference file found
public void receivexml(system.xml.linq.xelement xdoc, string strxmlfilename) { receivexmlrequest invalue = new receivexmlrequest(); invalue.body = new receivexmlrequestbody(); invalue.body.xdoc = xdoc; invalue.body.strxmlfilename = strxmlfilename; }
here not getting have written xmldocument type parameter receive why refrence.cs file created function system.xml.linq.xelement xdoc paramter instead of xmldocument type..?
i trying pass abc.xml file webservice loading in xmldocument xdoc.load(strabccontent);
when publish wcf service, decoupling actual implementation of service through interface, described wsdl
, technology agnostic. wsdl won't able specify content .net system.xml.xmldocument
, instead specify abstraction (xs:any
if remember correctly)
this why, when consuming service (even same .net technology stack), potentially different client interface (as system.xml.linq.xelement
).
you can replace xmldocument.load
linq 2 xml xdocument.load
on client:
var myxdocument = xdocument.load(strabccontent)
and pass service reference proxy method, receivexml
Comments
Post a Comment