http xml post

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
 
B

bruce barker

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)
 
C

Cindy H

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.
 
C

CindyH

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
 
M

Martin Honnen

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
 

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

Top