You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by Jeff Davis <jd...@idalica.com> on 2008/05/15 04:05:15 UTC

Working with HTTP Form Post (x-www-form-urlencoded Content-Type)

I've seen a few other posts on this topic in the mailing list, but never got
any real sense on how to accomplish it.

I'd like to use Synapse to receive an inbound HTTP POST which sends form
data in x-www-form-urlencoded fashion (i.e., subscriberId=2321&field1=val),
not XML. Is there a straightforward way of working with this or accessing
the inbound request via script mediator? From all the examples I've seen for
HTTP POST, it always pertains to working with POX/REST type stuff (I am
sending back XML, oddly enough).

Thanks in advance for your help, and my apologies if this has been answered
previously and I overlooked it.

jeff

Re: Working with HTTP Form Post (x-www-form-urlencoded Content-Type)

Posted by kalani <ka...@wso2.com>.
Hi Jeff,

There was an issue in the PlainTextBuilder [1] in building
x-www-form-urlencoded content in HTTP POST and it is fixed now.

You can either manually build the 1.2 branch [2] or wait until the next
build to test this with the attached configuration. You have to send the
request to "testProxy" as a HTTP POST with x-www-form-urlencoded content
in the body. Also you will need to change the message builder for the
x-www-form-urlencoded as follows in the axis2.xml

<messageBuilder contentType="application/x-www-form-urlencoded"

class="org.apache.synapse.format.PlainTextBuilder"/>

You can use a script mediator to do any transformation on the message.
(the provided configuration just echo the request as xml) 

Thanks,
Kalani

[1] - https://issues.apache.org/jira/browse/SYNAPSE-318
[2] - http://svn.apache.org/repos/asf/synapse/branches/1.2
 


On Wed, 2008-05-14 at 20:05 -0600, Jeff Davis wrote:
> I've seen a few other posts on this topic in the mailing list, but never got
> any real sense on how to accomplish it.
> 
> I'd like to use Synapse to receive an inbound HTTP POST which sends form
> data in x-www-form-urlencoded fashion (i.e., subscriberId=2321&field1=val),
> not XML. Is there a straightforward way of working with this or accessing
> the inbound request via script mediator? From all the examples I've seen for
> HTTP POST, it always pertains to working with POX/REST type stuff (I am
> sending back XML, oddly enough).
> 
> Thanks in advance for your help, and my apologies if this has been answered
> previously and I overlooked it.
> 
> jeff