How do I output webservice as XML stream? File?

M

Mark B

This code is returning a HTPP Internal Server Error.

How do I amend it to:

a) Create an XML file on the server
b) Return a XML stream to the person who called the webservice?


<System.Web.Services.WebMethod()> _
Public Function WsTableValuesGet( _
ByVal strPlatform As String _
) As String

Dim sqlConnection1 As New SqlConnection(GetConnectionString())
Dim cmd As New SqlCommand

Dim ds As New DataSet
cmd.Connection = sqlConnection1
cmd.CommandText = "uspServicesTableValuesGet"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@EnterPlatform", strPlatform)

Try
sqlConnection1.Open()
ds.DataSetName = "XMLData"
ds.Load(cmd.ExecuteReader(), LoadOption.OverwriteChanges,
"XMLData")
ds.WriteXml("MyNewXMLFile.xml", XmlWriteMode.IgnoreSchema)

Catch ex As SqlException
Throw ex
Finally
sqlConnection1.Close()
sqlConnection1.Dispose()
cmd.Dispose()
End Try

End Function
 
J

John Saunders

Mark B said:
This code is returning a HTPP Internal Server Error.

How do I amend it to:

a) Create an XML file on the server
b) Return a XML stream to the person who called the webservice?

Why is it returning an HTTP Internal Server Error? Why do you believe the
error has anything to do with how you return the data?
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top