New to web services AND XML, But this should be easy....


D

David Lozzi

Howdy,

I got the debug working great on a web service I'm writing. Currently, a
order number is requested, and it returns a vlaue from the order. Works
great! However, now that I got the connection down, how on earth do I format
the output of the web service into XML? I realize the output is XML, but I
need to make a bunch of elements and attributes and I can't seem to figure
out how. This is my first time with .Net and XMl (actually first time with
XML at all) so anything will help.

Do I use a XmlTextWriter? XmlWriter? How to I get the XML stream to return?

Thanks a ton!!
 
Ad

Advertisements

D

David Lozzi

Here's what I did:

<WebMethod()> Public Function OrderDetails(ByVal orderno As String) As
XmlDocument
Try
Dim doc As New XmlDocument
'...connection stuff here, send order number, etc. return
dataset
doc.LoadXml("<items><item><phone>" & phone &
"</phone></item></items>")

Return doc
Catch ex As Exception
End Try
End Function

Is this correct? Is this suppose to be how its done? It works, it returned
what I expected:

<?xml version="1.0" encoding="utf-8" ?>
- <items>
- <item>
<phone>8005551234</phone>
</item>
</items>

Please advise before I keep with this....

thanks!
 

Top