You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by "Moise, Daniel" <Da...@Intuit.com> on 2009/09/11 20:00:25 UTC

extracting the GET request params, and change the input url dynamically

Hi,

I am working on a project that uses the Synapse 1.3 as a gateway for our
services. I'd like to change the To address (GET request with
parameters) for an incoming message. Here is an example.
Income request (GET) URL:
http://synapseserver/services/url?param1=value1&param2=value2
I want to change it into:
http://internalserver/services/differenturl?a=value1&b=value2
 
Thanks,
Daniel Moise

Re: extracting the GET request params, and change the input url dynamically

Posted by Ruwan Linton <ru...@gmail.com>.
Hi Daniel,

On Fri, Sep 11, 2009 at 11:30 PM, Moise, Daniel <Da...@intuit.com>wrote:

> Hi,
>
> I am working on a project that uses the Synapse 1.3 as a gateway for our
> services. I'd like to change the To address (GET request with
> parameters) for an incoming message. Here is an example.
> Income request (GET) URL:
> http://synapseserver/services/url?param1=value1&param2=value2
> I want to change it into:
> http://internalserver/services/differenturl?a=value1&b=value2
>
>
In the case of GET, you need to have the operation in the url as well;

So the URL that you are invoking will be something like following;

http://synapseserver/services/serviceurl/operation?param1=value1&param2=value2<http://synapseserver/services/url?param1=value1&param2=value2>

in which case the payload inside synapse will be;

<operation>
  <param1>value1</param1>
  <param2>value2</param2>
</operation>

So assuming that you want to change both the operation and the service URL,
with the parameter names, you need to specify the service URL in the
endpoint that you use to send this message out while trasnforming the
message into the following form using an XSLT.

<differentOperation>
  <a>value1</a>
  <b>value2</b>
</differentOperation>

then use the follwoing addres endpoint to send it out;

<endpoint name="internal_ep_addr">
  <address uri="http://internalserver/services/differentServiceurl"/>
</endpoint>

The GET request going out from synapse to the internal server will be as
follows;

http://internalserver/services/differentServiceurl/differentOperation?a=value1&b=value2

Hope this will help you to understand what you need to do, also please note
that the default operation for synapse is "mediate" if you do not specify
any WSDL when creating the proxy service and you need to use that to invoke
synapse in a REST full manner.

Thanks,
Ruwan

Thanks,
> Daniel Moise
>



-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com