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 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
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
> 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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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,...
|
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...
| |