Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Consuming XML Web Service

Reply
Thread Tools

Consuming XML Web Service

 
 
=?Utf-8?B?UGV0ZXI=?=
Guest
Posts: n/a
 
      03-08-2005
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


 
Reply With Quote
 
 
 
 
gaidar
Guest
Posts: n/a
 
      03-08-2005

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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXI=?=
Guest
Posts: n/a
 
      03-08-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >
> >

>
>
>

 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      03-08-2005
> 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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Consuming local web service - ok, remote web service -problem? dgleeson422111 ASP .Net Web Controls 0 01-26-2010 11:17 AM
Error Consuming Web Service from WIndows application when WebService is using Custom Service Account ( Create an Application Pool with a Custom Identity) DNB ASP .Net Security 1 01-22-2008 09:08 PM
Error Consuming Web Service from WIndows application when WebService is using Custom Service Account ( Create an Application Pool with a Custom Identity) DNB ASP .Net Web Services 1 01-20-2008 01:47 PM
SOAP Header in a Dot Net 2.0 Web Service Client Consuming a WCF 3.0 service. Curt K ASP .Net Web Services 3 06-15-2007 10:19 PM
Consuming NOAA XML web service xml .NET group ASP .Net 2 04-13-2007 08:46 PM



Advertisments