How do I output webservice as XML stream? File?

  • Thread starter Thread starter Mark B
  • Start date Start date
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
 
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?
 
Back
Top