getting xml string through Request.InputStream

Last post 11-20-2003 4:59 AM by harishbalaji. 2 replies.

Sort Posts:

  • getting xml string through Request.InputStream

    11-15-2003, 1:44 AM
    • Member
      235 point Member
    • niner911
    • Member since 11-19-2002, 10:38 AM
    • Posts 47
    i'm passing xml string like this:

    http://localhost/myservice/input.aspx?<name>james</name>

    so in the input.aspx, i tried to do this:


    XmlDocument doc = new XmlDocument();
    doc.Load(Request.InputStream);


    however, the InputStream length is always 0, and there seems to be nothing in it. what is wrong with my setup?

    i need to pass xml this way since this is now flash mx's .sendAndLoad() passing xml data to the server.

    thanks!
  • Re: getting xml string through Request.InputStream

    11-15-2003, 10:25 AM
    • Member
      70 point Member
    • saileaf
    • Member since 10-09-2003, 5:45 PM
    • Posts 14
    You only showed part of your program, so it is really hard to tell. However there is one thing you might forget, did you enable HTTP POST? Web Service disables the HTTP POST by default, you need to enable it either in machine.config or in web.config.
  • Re: getting xml string through Request.InputStream

    11-20-2003, 4:38 AM
    • Member
      5 point Member
    • harishbalaji
    • Member since 08-05-2003, 3:51 AM
    • Posts 1
    Try the following code to read the XML content from the Input Stream

    Imports System.IO

    Dim iostr As StreamReader

    Dim objXML As XmlDocument
    Dim objRoot As XmlElement
    Dim docRead As XmlReader


    objXML = New XmlDocument()

    Try
    iostr = New StreamReader(Request.InputStream)
    objXML.LoadXml(iostr.ReadToEnd())
    Catch ex As Exception
    Response.Write(ex.ToString)
    Finally
    'Response.End()
    End Try

    objRoot = objXML.DocumentElement

    Response.Write(objRoot.Name)

    and continue to parse the XML content

    Hope this would solve your problem.
Page 1 of 1 (3 items)