Extract parameters from external call

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Extract parameters from external call

bhargav.tri
Hi,
I hope I am able to explain the scenario over here.

I am making a http POST call to an external gateway from one of my ftl
file. One of the parameters in the call is say redirect_url.

As an example:  Say I have specified one of the request-map in my
controller.xml as below:
<request-map uri="xyz">
        <security https="true" auth="false"/>
        <event type="java" path="<some java class>" invoke="<some event
handler>"/>
        <response name="success" type="request" value="<handle success
from this event>"/>
        <response name="error" type="view" value="<go to error page>"/>
</request-map>

Now I am specifying the value of redirect_url  from my ftl by <@ofbizUrl>
xyz</@ofbizUrl>

Once this call is processed by the external system, it redirects to a
specified url in redirect_url and my <some event handler>is being invoked.
But this external system is responding with some fields using GET method.
And I am not sure how to capture this fields since I am not able to see
them in the request variable.

Can some one please help me out on what would be the correct way to make
such a call to an external gateway?

Bhargav
Reply | Threaded
Open this post in threaded view
|

Re: Extract parameters from external call

Rajbir Saini
Hello Bhargav,

Processing a request form external system is no different from
processing a request from your browser. In fact all request coming to
OFBiz are from an user agent such as browsers, bots or some other clients.

To collect the request parameters (either get or post), you can use
various HttpServletRequest#getParameter* methods or OFBiz UtilHttp [1]
utility class.

[1]
http://ci.apache.org/projects/ofbiz/site/javadocs/org/ofbiz/base/util/UtilHttp.html

Thanks,

Raj

PS: Please do not cross post. OFBiz dev list is to discuss the OFBiz
development related issues. It is always safe to ask your questions to
user list and if there is a need someone from dev will ask you to move
your question to dev list.

On Saturday 16 June 2012 07:06 AM, [hidden email] wrote:

> Hi,
> I hope I am able to explain the scenario over here.
>
> I am making a http POST call to an external gateway from one of my ftl
> file. One of the parameters in the call is say redirect_url.
>
> As an example:  Say I have specified one of the request-map in my
> controller.xml as below:
> <request-map uri="xyz">
>          <security https="true" auth="false"/>
>          <event type="java" path="<some java class>" invoke="<some event
> handler>"/>
>          <response name="success" type="request" value="<handle success
> from this event>"/>
>          <response name="error" type="view" value="<go to error page>"/>
> </request-map>
>
> Now I am specifying the value of redirect_url  from my ftl by<@ofbizUrl>
> xyz</@ofbizUrl>
>
> Once this call is processed by the external system, it redirects to a
> specified url in redirect_url and my<some event handler>is being invoked.
> But this external system is responding with some fields using GET method.
> And I am not sure how to capture this fields since I am not able to see
> them in the request variable.
>
> Can some one please help me out on what would be the correct way to make
> such a call to an external gateway?
>
> Bhargav

Reply | Threaded
Open this post in threaded view
|

Re: Extract parameters from external call

bhargav.tri
Thanks for the reply Raj.

I was under the same impression and I was not able to fetch the parameters using getparameter.

But I was able to retrieve them using the Utility class (UtilHttp). That was helpful.

Thank you,

Bhargav