I have an endpoint like this:
http://endpoint/getResult?sid=1&sid=2&sid=3...
I want to create a REST API like this, route the request to the Endpoint:
http://esb/getResult?sid=1,2,3
How can I achieve this using WSO2 ESB? Many thanks.
try a Java script mediator and take sid into the new String
After you can use a function split with delimiter “,”
Related
Hi I am new to wso2 .
I want to call two different service (different URL) using a Proxy service based on some condition
I have two different service 1) One service to add and subtract two numbers 2) Another service to multiply and divide two numbers I want to create a proxy service to call this two service based on some condition,say if 1st number greater than second number,i need to call 1st service,otherwise i need to call second service
How to implement this using a proxy service
Can anyone help me how to use Conditional route mediator to implement this
Suggest me the best way to do this,Since i am new to WSO2,please help me in brief
Thanks in Advance
With WSO2 ESB, you can do this either via Filter Mediator or Conditional Router Mediator. There are many mediators and you can build your logic using desired mediators.
I would suggest you to go through documentation and samples.
There is one sample on Conditional Router Mediator, which will help you to understand on Conditional Router usage.
I think in your case, you should be able to use Filter mediator to compare your values via XPath operators.
For example, see the sample 156's filter mediator usage.
If you pass your values as URL parameters, you can get those URL parameters as properties.
Please note that these are just pointers for you to get started.
You can also try the WSO2 Developer Studio to create the ESB artifacts.
I hope this helps.
I have one data service in WSO2 DSS. And also its possible to call using browsers.But i can't make a request using ajax to call this service.I think CORS issue is occurring.So i want to add Access-Control-Allow-Origin parameter to response header.How this is possible in WSO2 DSS ,Any suggestion ?
I think you can put a custom headers by adding axis2 custom out flow handler.
http://shivendra-tripathi.blogspot.com/2010/04/adding-handler-in-axis2.html?m=1
http://shivendra-tripathi.blogspot.com/2010/04/adding-soap-header-in-axiom.html?m=1
Is it possible to register endpoints with URI templates in the API Publisher that ships with WSO2 API Manager version 1.4.0? For example, I would like to register an endpoint such as:
/jobs/{jobid}/pems
After saving an API, I can see this bit in the API config file:
<resource methods="GET" url-mapping="/jobs/{jobid}/pems">
I have tried manually changing the XML file from url-mapping to uri-template, i.e., to:
<resource methods="GET" uri-template="/jobs/{jobid}/pems">
but I still get "No matching resource found in the API for the given request". In any case, this is not a good work around since we need developers to be able to register these endpoints from the publisher application. Whenever changes are saved to an API from within the API Publisher interface, 'uri-template' gets reverted back to 'url-mapping'.
Thanks in advance.
This is due to APIPublisher app only supports URL-Mappings when defining API resources.
If you want to define a uri-template ,instead of a url-mapping,you can achieve this from changing the api xml manually.
But before that make sure,when creating the API,you have define the API with a valid url-mapping.So in your trying API,first please edit the API from APIPublisher as keeping a valid url-mapping pattern for API resources and then change its xml to match with your mentioned uri-template pattern.
Thanks;
we don't currently support uri-template patterns. We support only url-mappings.
Even , if you edit the backend API configuration (that is, api configuration file ) to url-mappings, it wont work, because we validate request before the request get hits the mediation engine.
You can use ESB RESTApi as your backend service endpoint.That is, define the RESTAPI in wso2esb, with uri-templates(it is supported out of the in ESB) and point that API as the service endpoint from wso2APIManager with url-mappings pattern.
I would like to add some more points.As I mentioned earlier,WSO2 APIManager supports uri-templates.Only api-publisher app UI is not allowing to add uri-templates.
When creating the API from the Publisher UI, you have to give the resource mapping as /* or valid url-mapping. Then when the synapse api is created, you have to change that xml file to uri-template and then change the /* to the uri-template pattern.
Hope above will help you to resolve your issue.
Thanks;
How can i chnage the HTTP Method in wso2 esb using java class mediator
currently I am using
mc.setDoingGET(false);
mc.setDoingPOX(true);
I want to take a post request to ESB and then send to a webservice via GET or vice versa
but the above code is not working at all
Use the property mediator with property name: HTTP_METHOD and http method name as the value (GET,POST etc) and scope as 'axis2'.
If you want to change this property in the java class level, you may do the following:
msgCtx.setProperty(Constants.Configuration.HTTP_METHOD, "GET");
I have created a service (Products) which accepts a ProductID value and returns data. I have SOAP and HTTP requests and responses for this service. I can access this by doing something like h**p://localhost:9763/services/Products.HTTPEndpoint/ProductID/123456 to return data.
How can I do the same thing but go through the ESB? I've tried to set up a simple pass through proxy, but when I use the "TryIt" I only get "mediate" as a option.
Any ideas?
Thanks,
Jared
You should use an appropriate WDSDL as the publish WSDL of the proxy service to 'tryit' the proxy service.
So what you can do is, get the WSDL of the actual data service and use that as the publish wsdl of the proxy. Then you can use tryit to invoke the DS.
I ended up being able to do this:
WSO2 Data Services Server service:
http://localhost:9763/services/Products
WSO2 ESB Endpoint:
Name: epProducts
Address: http://localhost:9763/services/Products.HTTPEndpoint
Format: GET
WSO2 ESB Proxy Service:
Service Name: ProductsProxy
Publishing WSDL: None
Define In Sequence: None
Define Endpoint: epProducts
Define Out Sequence: None
Define Fault Sequence: None
Send a GET request to:
http://localhost:9763/services/Products.HTTPEndpoint/ProductID/123456