Connecting Tech Pros Worldwide Forums | Help | Site Map

XmlNode to XmlDocument question.

jens Jensen
Guest
 
Posts: n/a
#1: Feb 13 '06

Hello,
I have built a client of a websevrice. I call a webmethod that takes an
Xmldocument object and returns an Xmldocument object.
When i add a refernce to this webservice on the client, then the input
output types of my webmethod generated in the proxy class are changed to
XmlNode. This mean, I get XmlNode as input argument instead of XmlDocument
and the same for the return type.

I'm using Vsual Studio 2005.


How do i get my XmlDocument back from the XmlNode?

Any help will be highly appreciated.

many thanks in advance
JJ



Josh Twist
Guest
 
Posts: n/a
#2: Feb 15 '06

re: XmlNode to XmlDocument question.


I'd urge you to reconsider your use of XmlDocuments in Web Services.

The whole point of Web Services is that they are self describing but
your web method would simply describe itself as "friendly webmethod
takes anything and returns something". Not very helpful :)

You should consider returning actual business objects - that is custom
classes - that represent the actual parameters and response types that
you want your web service to deal with. The XmlSerializer takes care of
the rest.

Read this:
http://msdn.microsoft.com/library/de...howwebmeth.asp

Hope that helps

Josh
http://www.thejoyofcode.com/

jens Jensen
Guest
 
Posts: n/a
#3: Feb 16 '06

re: XmlNode to XmlDocument question.


Well Josh,
Thank you for your comment. the issue here is that the webservice was
written with java.
wsdl.exe was not able to generate a proper proxy class.
So i have not written the webservice.
The author provided a proxy class that can be used and that make use of some
soap extension feature.


This is why
JJ


Machu
Guest
 
Posts: n/a
#4: May 10 '06

re: XmlNode to XmlDocument question.


Hi Josh,
[color=blue]
> I'd urge you to reconsider your use of XmlDocuments in Web Services.[/color]
I'm presuming XmlDocuments are very expensive to persist via WebServices?

Thanks

--
..NET wannabe


"Josh Twist" wrote:
[color=blue]
> I'd urge you to reconsider your use of XmlDocuments in Web Services.
>
> The whole point of Web Services is that they are self describing but
> your web method would simply describe itself as "friendly webmethod
> takes anything and returns something". Not very helpful :)
>
> You should consider returning actual business objects - that is custom
> classes - that represent the actual parameters and response types that
> you want your web service to deal with. The XmlSerializer takes care of
> the rest.
>
> Read this:
> http://msdn.microsoft.com/library/de...howwebmeth.asp
>
> Hope that helps
>
> Josh
> http://www.thejoyofcode.com/
>
>[/color]
Martin.Kunc@gmail.com
Guest
 
Posts: n/a
#5: May 10 '06

re: XmlNode to XmlDocument question.


Hello,
yes, it is expensive as collegues said, but it is in-memory indexed.
either you can use XmlReader or XpathNavigator for low-memory
consumption, but you can also read it afterwards quickly, it depends on
what do you need to do with it.
To your question:

XmlNode xn = new XmlNode(); // your xmlNode
XmlDocument xdoc = new XmlDocument();
xdoc.ImportNode(xn, true);

cheers,
Martin

Closed Thread