473,233 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,233 software developers and data experts.

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 17521
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Anita C | last post by:
I have the foll. code to update the value of an attribute: xmlDocument.Load("abc.xml"); XmlAttribute xmlAttrib = xmlDocument.SelectSingleNode(root/web/theme/@desc); xmlAttrib.Value =...
5
by: Ian Williamson | last post by:
Greetings, I have seen this question posted a few times, but the answers have not helped me. I have used the program xsd.exe to generate several c# classes from a client provided xsd...
3
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
3
by: Siu | last post by:
Hi, I've loaded an XmlDocument from a file XML: this file has many similar XmlNode and it is difficult to select them by using SelectSingleNode of the object XmlDocument. I've this question: is...
5
by: Paul | last post by:
Here I have the definition of an XmlNode which is a property (PayPreference) on my Customer class containing an enum describing how the customer will pay. <PayPerference...
5
by: Mahesh Devjibhai Dhola | last post by:
Hi All, I want to make a custom class in c#, which extends System.Xml.XmlNode class of BCL. Now in custom class, I have implement abstract methods of XmlNode class also. Now when I am trying to...
3
by: Earl | last post by:
In VB.Net, the following declaration builds and executes with no exceptions: Dim XMLDoc As New XmlDocument Dim Node As XmlNode But in C#, the following (equivalent?!) returns the build error...
5
by: GaryDean | last post by:
I have a web service method that returns an XMLDocument. The signature is: public XmlDocument GetPOs() The following client code calls this method but it accepts an XMLNode instead of an...
1
by: Andrus | last post by:
How to remove whole Xmlnode so that outer tags are also removed ? To reproduce, run the code. Observed result: <Query> <DataSourceName>DS1</DataSourceName> <QueryParameters>...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.