wso2 DSS Dynamic Data Source Switching - wso2

I have an Rest service build on wso2 Dss. This Rest call an SQL query link to an datasource.
I cannot find the way to switch on runtime the datasource. I want with the same service, do the same query on an different datasource that I can specified in parameter.
Thank for your help.
Best regards,
Nicolas

You can make several DSS services with different datasource and make Proxy service in WSO ESB to balancing requests to your DSS services by parameter in url.

Related

How to add OAuth feature to DSS

I am currently using WSO2 DSS to create RESTful APIs to access the databases.
I need DSS to perform OAuth authentication for every incoming request. Is there a way I can do it without using WSO2 API Manager or WSO2 ESB?
If I have to change the source code to implement this feature, which particular library should I be looking into?
For this scenario without using WSO2 API Manager you need use three products of WSO2 SOA Suite (ESB, IS, DSS). In other case you can add the WSO2 DSS as a feature to the WSO2 ESB, and use IS as key manager. Check this links and take your best decision.
http://wso2.com/library/tutorials/2015/05/tutorial-hosting-restful-web-services-using-oauth-with-the-wso2-platform-0/
https://www.yenlo.com/blog/wso2-tutorial-adding-wso2-data-services-server-dss-as-a-feature-to-the-wso2-esb

WSO2 API Manager Mashup

Is there any way to create a mash up service using WSO2 API Manager? My goal is to create two Web services, then generate some data on which business logic is applied. This final data then needs to be fed into a third Web service.
I think you can use Apache Camel to create a mashup API easily.

share business objects between webservice

I want to expose on wso2 esb or wso2-as a set of webservices sharing
the same business object model.
What is the best way to do it with wso2 and DeveloperStudio ?
Tks
Nicolas
You can put the relevant jar inside CARBON_HOME/repository/components/lib folder.
Just deploy all your services(*.aar or spring service) in wso2AS and keep your libraries in
repository/components/lib folder.
Wso2esb is not used to host services, rather it is used as mediation engine.

How to use Datasource configured in WSO2 BPS

I am new to WSO2 family (WSS, ESB & BPS).
Previously I did samples on creating datasource in WSO2 ESB and I have retrieved data from datasource using DBLookup in WSO2 ESB.
Now I have configured datasource in WSO2 BPS(from UI) and it is successfully connected to the database.
How Can I use the datasource that I configured in BPS in BPEL Workflow?
Please someone guide through it.
Thanks in Advance.
Please refer the doucumentation[1] which shows how to define a datasource and refer [2] which shows how to configure datasource in bps.xml
[1] http://docs.wso2.org/wiki/display/BPS300/Adding+RDBMS+Data+Sources#AddingRDBMSDataSources-jndi
[2] http://docs.wso2.org/wiki/display/BPS300/ODE+Configurations#ODEConfigurations-DataSource
I think the better approach would be to use WSO2 Data Services Server and create Data Service using the data source. (You can define the data source in Data Services server). After that you can call them using the BPS. Please refer following tutorial on such a comprehensive tutorial.
http://docs.wso2.org/wiki/display/DVS300/Retail+Banking+Sample

What is the best practices for WSO2 ESB in perticular XSLT transformations

I am working on WSO2 ESB 4.0.3 on MAC OS X Lion (10.7.4)
I would like to know what are the best practices for development for WSO2 ESB 4.0.3.
Currently I am using Data Services Feature in it and existing tomcat application, which we are trying to port to WSO2 ESB, does the SQL query in 2-3 seconds where as WSO2 ESB 4.0.3 with Data Services feature taking around 16-17 secodns.
I would be thankful if some body can let me know best practices for WSO2 and in perticular XSLT transformation.
Hoping for answer.
thanks
Hi Prabath
Here is how my environment is
I am using WSO2 ESB 4.0.3 with Data Services Feature 3.2.2. Proxy service front ends the DS service. Data sources are defined as carbon data sources in datasources.properties.
I tried to run the same service in the WSO2 Data Services Server 2.6.3 and the performance is comparable to what existing tomcat application does but the ESB 4.0.3 with Data Services Feature 3.2.2 takes 8 times more time than tomcat application. Looks like XSLT is not a issue as I thought earlier.
I have all the error handling & input validation in the proxy service which calls this DS.
Also I tried changing it to local for the transport but still same performance issue. Also I have to make sure the format of the forwarded XML is SOAP 12 in the end point definition otherwise proxy service does not forward with local transport.
Can you please suggest so that I can use WSO2 ESB with Data Services Feature 3.2.2 and get comparable performance?
Help really appreciated.
thanks
Abhijit
Hi Prabath
Thanks for reply.
Proxy service validation and transformation is not a problem. Looking at the logs it looks like Data Service deployed in ESB with Data Services feature is taking 8 times more time than the tomcat application. So it is Data Services Feature which is problem I believe and not the proxy service.
Even if we remove the proxy service where you will do the input validations and error handling?
Please let me know.
thanks
Abhijit
Abhijit,
I'm not quite clear of whether this problem is related to executing SQL using dbReport/dbLookup mediators against doing the same thing having data services features installed in ESB OR transforming responses using XSLT at the ESB layer against doing it at the DSS layer.
If it's the former, then you should be able to effectively use the db mediator pair (namely dbLookup and dbreport) to execute simple SQL queries such as SELECT, INSERT, UPDATE, DELETE, etc. However, it is not recommended to do use those mediators to do much complex queries such as stored procedures with "OUT and INOUT" parameters etc as WSO2 DSS is specifically designed to serve any sort of complex queries like that. However, this (using data services) comes at the cost of network latency. Because, you're invoking a data service endpoint through the network which obviously adds the network latency to the end-to-end time taken to get your task done. However, if you're using Data Services features installed in the WSO2 ESB, you always have the option of using "local" transport instead of "http/https" which does an in-JVM call and thus would not dispatch the request over the network.
If this is related to the later, meaning, if you refer to the XSLT transformations, I believe there's no such hard and fast rules in doing this and this would completely depend on your requirements and the usecase. For example, if you're only using WSO2 DSS and want to get some request transformed into a particular format that is expected by the client side, it would only be enough for you to get it done at the WSO2 DSS layer. Because, dispatching it into ESB ONLY for the sake of getting the XSLT transformation done, would add an additional unwanted overhead to the end-to-end completion time of your task. On the other hand, if you're doing this as a part of a configuration flow at the ESB side, then it's perfectly okay to use something like XSLT mediator inside the flow itself.
Hope this helps!
Regards.
Prabath
I hope Prabath already gave the answer to your question.
However, it is not recommended to do use those mediators to do much complex queries such as stored procedures with "OUT and INOUT" parameters etc as WSO2 DSS is specifically designed to serve any sort of complex queries like that. However, this (using data services) comes at the cost of network latency. Because, you're invoking a data service endpoint through the network which obviously adds the network latency to the end-to-end time taken to get your task done. However, if you're using Data Services features installed in the WSO2 ESB, you always have the option of using "local" transport instead of "http/https" which does an in-JVM call and thus would not dispatch the request over the network.