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!!
 
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top