http xml post

  • Thread starter Thread starter CindyH
  • Start date Start date
C

CindyH

Hi

I'm working on a http xml post (request/response).

In my testing - I have been able to create and post xml string/stream and
send response
back.

But now I've been told that I should "code the whole xml payload string as a
single key"

I'm not sure what this means and haven't been able to find anything about
it.

Can anyone help me with this?

Thanks,
Cindy
 
generally this means they want a form post with one form field
containing the xml. in this case your post data is:

string postdata = "fieldname=" + HttpUtility.UrlEncode(doc.OuterXml);

note: you should set the content-type to:
application/x-www-form-urlencoded

-- bruce (sqlwork.com)
 
That makes sense - I'll check it out and get back to you on this.
Thanks a lot - I think you got me on the right road.
 
Hi

I'm wondering how I go about reading this for sending a reponse back.

Currently, I'm using:

Stream = New System.IO.StreamReader(Page.Request.InputStream)

Reader = New System.Xml.XmlTextReader(Stream)

Do While Reader.Read()

This of course doesn't work with httputility.urlencode(doc.outerxml) as a
post

Thanks,

Cindy
 
CindyH said:
This of course doesn't work with httputility.urlencode(doc.outerxml) as a
post

If the data is posted as application/x-www-form-urlencoded then you can
access it with
Request.Form("fieldname")
so
Using reader As XmlReader = XmlReader.Create(new
StringReader(Request.Form("fieldname")))
While reader.Read()
'...
End While
End Using
 
Back
Top