How to return a stream of XML rather than a dataset

J

JJA

I am confused about all the various methods of handling XML in ASP.Net
2.0. I want to be able to stream XML to some clientside Javascript code
(snippet below):

var urlRequest = "../GetLendersAsXML.aspx"
var request = GXmlHttp.create();
request.open("GET", urlRequest, true);
request.onreadystatechange = function() {
if (request.readyState == 4) {
var xmlDoc = request.responseXML;

I have all the Javascript code I need but I need to have the page above
return XML.

Using SQL 2005 I have created an HTTP endpoint and exposed a stored
procedure as a webservice. I want to add a FOR XML AUTO clause in the
stored procedure to return XML as a big string (that part is easy). The
sproc currently returns a dataset and I've got this code below that
binds it to a GridView (this works but is not what I need):

Partial Class GetLendersAsDataset
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Try
Dim ws As yukon.ITMO_Lenders = New yukon.ITMO_Lenders
Dim ds As System.Data.DataSet
ws.Credentials = New System.Net.NetworkCredential("myID",
"myPass", "myDomain")
Dim oa As Object()
oa = ws.GetLenderLocations("GOLDEN EMPIRE MORTGAGE")
'hardcode example for testing
If oa(1).ToString() = "System.Data.DataSet" Then
ds = DirectCast(oa(1), System.Data.DataSet)
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
End If
Catch ex As ApplicationException
Response.Write(ex.ToString)
End Try
End Sub
End Class

So, if I change my stored procedure by adding FOR XML clause, then
ws.GetLenderLocations webmethod above will return XML. Can anybody
suggest code for my ASPX page to stream this XML so that my Javascript
at the top of the post can read it?
 

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,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top