473,394 Members | 1,867 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,394 software developers and data experts.

Consuming XML Web Service

Hi!

Please, could You advice me to complete the following task:

We have a Web Service that returns XML document with some data about our
customers.

[WebMethod]
public XmlDocument getCustInfo()
{
//some implementation
}

I am trying to parse that document and to print customers' names and email
addresses. If some custorem does not have an email address I print "no email
address found". I have to go throught the xml document and it's nodes using
eg. foreach statement and resolve whether customer has an email address with
if else statements.

Please, could You tell me, how can I load this Xml document which WebService
provides? I tried to load it into XmlDocument object with Load method, but
beacause it is not xml file I get errors. The help is very much appreciated.

Thanks.

Peter
Nov 19 '05 #1
3 1112

Hi, Peter,

You can get text from your Web Service. I see no problem in transmitting
XML-formatted string. Anyway, you can get string data and produce XML
document manually.
Could you explain your problem? I just don't understand...

Best Regards,
Gaidar

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
Hi!

Please, could You advice me to complete the following task:

We have a Web Service that returns XML document with some data about our
customers.

[WebMethod]
public XmlDocument getCustInfo()
{
//some implementation
}

I am trying to parse that document and to print customers' names and email
addresses. If some custorem does not have an email address I print "no
email
address found". I have to go throught the xml document and it's nodes
using
eg. foreach statement and resolve whether customer has an email address
with
if else statements.

Please, could You tell me, how can I load this Xml document which
WebService
provides? I tried to load it into XmlDocument object with Load method, but
beacause it is not xml file I get errors. The help is very much
appreciated.

Thanks.

Peter

Nov 19 '05 #2
Hello!

Thank you for the reply! I managed to resolve the issue. I just had to use
XmlNode, eg.

XmlNode custInfo;
custInfo = service.getCustInfo();

foreach (XmlNode Node in custInfo)

if (Node.ChildNodes[1].InnerText !="") //No email found

Now I can process the xml document returned by web service.

Peter

"gaidar" wrote:

Hi, Peter,

You can get text from your Web Service. I see no problem in transmitting
XML-formatted string. Anyway, you can get string data and produce XML
document manually.
Could you explain your problem? I just don't understand...

Best Regards,
Gaidar

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
Hi!

Please, could You advice me to complete the following task:

We have a Web Service that returns XML document with some data about our
customers.

[WebMethod]
public XmlDocument getCustInfo()
{
//some implementation
}

I am trying to parse that document and to print customers' names and email
addresses. If some custorem does not have an email address I print "no
email
address found". I have to go throught the xml document and it's nodes
using
eg. foreach statement and resolve whether customer has an email address
with
if else statements.

Please, could You tell me, how can I load this Xml document which
WebService
provides? I tried to load it into XmlDocument object with Load method, but
beacause it is not xml file I get errors. The help is very much
appreciated.

Thanks.

Peter


Nov 19 '05 #3
> Please, could You tell me, how can I load this Xml document which
WebService
provides? I tried to load it into XmlDocument object with Load method, but
beacause it is not xml file I get errors. The help is very much
appreciated.
What errors are you getting? Here's why I'm asking:

According to your WebMethod declaration, it returns a
System.Xml.XmlDocument. I don't believe this class is serializable. It isn't
marked as serializable It is important to note the difference between an
XmlDocument class and an XML Document. An XmlDocument class is a class for
working with XMLDocuments.

A WebMethod returns an instance of a class, as an XML Document (NOT a
System.Xml.XmlDocument). The class must be serializable. At the client end,
the class is deserialized back into a class. So, as you can see, it isn't
necessary to create an XML Document; the response is one already. It is
necessary to create a serializable class that can be returned and
de-serialized back into a class.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.

"Peter" <Pe***@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com... Hi!

Please, could You advice me to complete the following task:

We have a Web Service that returns XML document with some data about our
customers.

[WebMethod]
public XmlDocument getCustInfo()
{
//some implementation
}

I am trying to parse that document and to print customers' names and email
addresses. If some custorem does not have an email address I print "no
email
address found". I have to go throught the xml document and it's nodes
using
eg. foreach statement and resolve whether customer has an email address
with
if else statements.

Please, could You tell me, how can I load this Xml document which
WebService
provides? I tried to load it into XmlDocument object with Load method, but
beacause it is not xml file I get errors. The help is very much
appreciated.

Thanks.

Peter

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt D | last post by:
I've got two web services that use the same data types and that clients will have to consume. I read the msdn article on sharing types...
6
by: kbs | last post by:
Hi, I'm looking for some good examples that illustrate how to code a web service that exposes a custom collection so that the properties of the collection are accessible on the client without...
2
by: Glenn Venzke | last post by:
Is there any way to tell what type of application is consuming a web service? I'm writing a web service that returns a string with 2 carriage returns. What I want to do is replace these carriage...
0
by: plmanikandan | last post by:
I need to develop a application to consume a webservice. For consuming web service i tried a example in Consuming a Web Service in C# in http://www.csharphelp.com.But i am uanble to use that...
3
by: Jeremy Chapman | last post by:
I've writtin a very simple web service in axis which returns an array of classes. I consume it in a .net app. When receiving the response, my .net app generates an error "Cannot assign object...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...

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.