Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Services (http://www.velocityreviews.com/forums/f64-asp-net-web-services.html)
-   -   How to return XML Document from web service. (http://www.velocityreviews.com/forums/t786875-how-to-return-xml-document-from-web-service.html)

GH 02-04-2007 11:21 PM

How to return XML Document from web service.
 
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


Scott M. 02-05-2007 04:28 AM

Re: How to return XML Document from web service.
 
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" <dotnetgod@hotmail.com> wrote in message
news:1170631275.907638.202940@v33g2000cwv.googlegr 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
>




GH 02-05-2007 05:40 PM

Re: How to return XML Document from web service.
 
On Feb 4, 8:28 pm, "Scott M." <s...@nospam.nospam> 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" <dotnet...@hotmail.com> wrote in message
>
> news:1170631275.907638.202940@v33g2000cwv.googlegr 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


Scott M. 02-05-2007 07:11 PM

Re: How to return XML Document from web service.
 
> 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?




All times are GMT. The time now is 05:53 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57