[ic] Reading the HTTP body from a post?

Mike Heins interchange-users@icdevgroup.org
Fri Sep 20 15:40:00 2002


Quoting James Guillot (james.guillot@huntforpro.com):
> From:           	Mike Heins <mike@perusion.com>
> To:             	interchange-users@icdevgroup.org
> Subject:        	Re: [ic] Reading the HTTP body from a post?
> Send reply to:  	interchange-users@icdevgroup.org
> Date sent:      	Fri, 20 Sep 2002 13:22:13 -0400
> 
> > Quoting James Guillot (james.guillot@huntforpro.com):
> > > Hi All,
> > > 	What is the best way to read the body of an HTTP POST into an 
> > > interchange script?  (I tried [CGI...] but it only seems to work if the body of the 
> > > message is something like foo=<?xml....).  Here is an example of the message I'm 
> > > sending to Apache/Interchange:
> > > 
> > > POST /cgi-bin/risonline/punchout/setup.html HTTP/1.1
> > > Host: www.rustonind.com
> > > Connection: Keep-Alive
> > > From: jwguillot@huntforpro.com
> > > User-Agent: putty/0.52
> > > Content-Type: application/x-www-form-urlencoded
> > > Content-Length: 1281
> > > 
> > > <?xml version="1.0"?><!DOCTYPE cXML SYSTEM "cXML.dtd"><cXML 
> > > version="1.0" payloadID="2002-04-03T16:10:15-08:00" 
> > > timestamp="2002-04-03T16:10:15-08:00">
> > > <Header>.......
> > 
> > That isn't a POST of a content-type of x-www-form-urlencoded. It is a
> > PUT. A POST is a key/variable pair setup, with url encoding of the
> > data (i.e. %22 instead of ").
> > 
> > In other words, this is not compliant with HTTP spec so there is no
> > way Interchange would recognize it.
> > 
>
> Of course, you’re right Mike! I'm using telnet to simulate a
> PunchOutSetupRequest message and unintentionally had the wrong content
> type. I copied this directly from
> cXML.org's user guide. How can I access the body of a message like
>      this from within interchange? Thanks again!

You can't with 4.8, for Interchange doesn't process text/xml, only 
urlencoded an multipart/form-data. In 4.9, you could do a PUT and
IC could get at it.

Sounds like this would be a job for a proxy which would process the
XML and pass it to interchange as a normal POST, prepending the
appropriate variable name.

Assuming you want to accept it natively, the only thing I could suggest
would be to employ myself or some other competent consultant in the core
group to add processing for that content type into Interchange. It would
be a good thing to do in general and would then get promulgated to
future versions.

-- 
Mike Heins
Perusion -- Expert Interchange Consulting    http://www.perusion.com/
phone +1.513.523.7621      <mike@perusion.com>

"Laughter is inner jogging." -- Norman Cousins