Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > How to return XML Document from web service.

Reply
Thread Tools

How to return XML Document from web service.

 
 
GH
Guest
Posts: n/a
 
      02-04-2007
Can someone point me to an example of a VB.Net client that reads an
XML Document from a web service?

I have a web service that successfully creates an XML document, saves
it on the server and returns it to the calling client.

Maybe I don't understand all I know about this but for some reason
what is returned is an XMLNode, not a document. How does one usually
return an XML Document from a web service? SHould I be using
XMLDatadocument?

Thanks,
GH

 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      02-05-2007
If your webmethod's return value is an XMLDocument and that is, in fact,
what your code returns, then your web service returns an XMLDocument. So,
the calling code would look something like:

[vb.net]

'Assuming you have already made your web reference
Dim ws As New someServer.someService()
Dim xmlDoc As Xml.XmlDocument = ws.someMethodThatReturnsAnXMLDocument()




"GH" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Can someone point me to an example of a VB.Net client that reads an
> XML Document from a web service?
>
> I have a web service that successfully creates an XML document, saves
> it on the server and returns it to the calling client.
>
> Maybe I don't understand all I know about this but for some reason
> what is returned is an XMLNode, not a document. How does one usually
> return an XML Document from a web service? SHould I be using
> XMLDatadocument?
>
> Thanks,
> GH
>



 
Reply With Quote
 
 
 
 
GH
Guest
Posts: n/a
 
      02-05-2007
On Feb 4, 8:28 pm, "Scott M." <(E-Mail Removed)> wrote:
> If your webmethod's return value is an XMLDocument and that is, in fact,
> what your code returns, then your web service returns an XMLDocument. So,
> the calling code would look something like:
>
> [vb.net]
>
> 'Assuming you have already made your web reference
> Dim ws As New someServer.someService()
> Dim xmlDoc As Xml.XmlDocument = ws.someMethodThatReturnsAnXMLDocument()
>
> "GH" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) oups.com...
>
>
>
> > Can someone point me to an example of a VB.Net client that reads an
> > XML Document from a web service?

>
> > I have a web service that successfully creates an XML document, saves
> > it on the server and returns it to the calling client.

>
> > Maybe I don't understand all I know about this but for some reason
> > what is returned is an XMLNode, not a document. How does one usually
> > return an XML Document from a web service? SHould I be using
> > XMLDatadocument?

>
> > Thanks,
> > GH- Hide quoted text -

>
> - Show quoted text -



Thanks but when I do what you suggest I get the error:
"Unable to cast object of type 'System.Xml.XmlElement' to type
'System.Xml.XmlDocument'." This implies that my web service is not
really returning a document, however....


My web service says
Public Function GetWebOrders() As XmlDocument
Dim Doc As New XmlDocument
...... Build the document and Doc.Save it on the server
(which works fine)....
Return Doc
End Function

My Client says:
Dim xmlDoc As Xml.XmlDocument = ws.GetWebOrders()
....that's when I get the error above.


It has been suggested that I return the XML as a String but I dont
think that is the best way to do it.

--GH

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      02-05-2007
> It has been suggested that I return the XML as a String but I dont
> think that is the best way to do it.


Personally, I think that is the best way to do it. But, have you tried
casting your result as an XMLDocument?


 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Return XML Document from Web Service (.net v2) Andrew ASP .Net Web Services 0 03-11-2009 06:16 AM
how to return xml document from a web service R.A. ASP .Net Web Services 4 11-29-2004 08:04 PM
Refer to an XML document from within an XML document Manish Hatwalne XML 1 07-13-2004 10:24 AM
Help on including one XML document within another XML document using XML Schemas Tony Prichard XML 0 12-12-2003 03:18 PM



Advertisments