1 Reply Latest reply on Aug 6, 2010 5:42 PM by Scott Dawson

    method=post for http-gateway

    llll lll Newbie

      hi everyone.

      First of all, my English is poor, very sorry, hope you understand.

       

      my jboss-esb.xml

      <services>
        <service category="httptest" description="Hello WorldA"
         invmScope="GLOBAL" name="serviceA">
         <listeners>
          <http-gateway name="Http"/>
         </listeners>
         <actions mep="RequestResponse">
          <action name="action1" process="process"/>
         </actions>
        </service>
      </services>

       

      my action

      HttpRequest requestInfo = HttpRequest.getRequest(message);

       

      when client use method="get"

      http://127.0.0.1:8080/httpgateway/http/httptest/serviceA?a=3&b=4

        requestInfo is not null  and QueryParams is map

       

      but  method="post"

       

      <form method="post" action="http://127.0.0.1:8080/httpgateway/http/httptest/serviceA">
              <input type="text" name="a" value="3" />
              <input type="text" name="b" value="4" />
              <input type="submit"/>
          </form>

       

      requestInfo is not null  but QueryParams is null too

      why?

      How do I if client use method="post"

        • 1. Re: method=post for http-gateway
          Scott Dawson Apprentice

          Unfortunately POST parameters are not mapped into the QueryParams map like GET parameters are. You can get the POST parameters from the body of the message, so using your example,

          new String((byte[])message.getBody().get())

          will give:

          a=3&b=4

           

          You can use the decode method in java.net.URLDecoder to handle special characters like ampersands and equal signs.

          I'm looking for an easy way to parse the parameters from the string (and into a map or something similar). I'll post again if I find something useful or maybe someone else has a recommendation.

           

          Regards,

          Scott