468,321 Members | 1,811 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,321 developers. It's quick & easy.

XmlNode to XmlDocument question.


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
Feb 13 '06 #1
4 17253
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/

Feb 15 '06 #2
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
Feb 16 '06 #3
Hi Josh,
I'd urge you to reconsider your use of XmlDocuments in Web Services. I'm presuming XmlDocuments are very expensive to persist via WebServices?

Thanks

--
..NET wannabe
"Josh Twist" wrote:
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/

May 10 '06 #4
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

May 10 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Ian Williamson | last post: by
3 posts views Thread by Mahesh Devjibhai Dhola | last post: by
3 posts views Thread by Siu | last post: by
5 posts views Thread by Paul | last post: by
5 posts views Thread by Mahesh Devjibhai Dhola | last post: by
3 posts views Thread by Earl | last post: by
5 posts views Thread by GaryDean | last post: by
1 post views Thread by Andrus | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.