473,498 Members | 1,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 17531
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
14901
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
4676
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
8095
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
3566
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
5087
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
2128
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
2868
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
3860
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
3303
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>...
0
7124
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4586
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.