WSO2 API Manager & Web Service composition - web-services

Here's the scenario,
WS_A and WS_B are Web Services published in different endpoints.
WS_A receives personId, makes some processing, logs some data, and returns the name and the lastname of the Person with personId.
WS_B receives two Strings name and lastname and saves name+lastname in a database, then returns Ok/Error.
I need to publish an API API_Composition, using WSO2 API Manager, that will call WS_A, and send the result to WS_B, then return the result of WS_B.
Keep in mind that i can't make a new WS_C that has the behaviour of WS_A+WS_B, because i can't access the whole code of any of them.
Is there a way of doing this using only WSO2 API Manager?
Are there any other API Management products that can accomplish this requirement?
Regards

Yes, you can do this with mediator sequence. I have not found a specific tutorial for your scenario, but here's a blog post that has a demo on using mediator sequences and links to detailed documentation.
(Note: the demo and blog post are for WSO2 API Cloud - the hosted version of WSO2 API Manager. But it all works the same for API Manager - it is the same technology.)

Related

WSO2 EI REST API Manager Resource

I need to manage a Registry Resource deployed into the Enterprise Integrator.
Using the REST API like this:
https://localhost:9443/registry/resource/_system/governance/EstrattoContoEnti/xml/EstrattoContoEntiConf.xml
I can GET the resource, but...how can I modify this or create a new one?
Calling a PUT o POST I get Error 405 - Method Not Allowed.
Is there any API to manage the registry entries on the WSO2 EI?
Or may I need to use something else?
This is not possible out of the box via a REST API.
There is a AdminService for Registry and you may access that AdminService and get the related functionality via SOAP.
But in your case, since you are expecting a REST API, you can create a web-app client which will use this Admin-service, so that you have a REST API to the registry via this client.
There is already such a client written. Have a look at the steps on how to get this and configured from the following blog.
http://abeykoon.blogspot.com/2015/04/wso2-gov-registry-using-registry-api.html
Cheers.

WSO2 APIM : Get API Rating and Business Information through Store REST API

I have a custom page where I obtain Published API list using WSO2 Store Restful API
https://docs.wso2.com/display/AM220/apidocs/store/#!/operations#APICollection#apisGet
The problem is the returned result does not includes API Rating and Business Information whereas the Jaggery API that has been used by the default API Manager UI does include it. Is there any way to configure it so the REST API returns that data?
If I use the jaggery API instead, it is cookie based while I am using OAuth2 OIDC Service Provider of the IS. I cant obtain API that has visibility to only its own domain by passing access token to the Authorization header.
APIM Version: 2.2
Please Advice. Thanks!
There is no such a way which will change the output response of defined APIs.
If you want to do that, get source code of wso2 from github & edit the APIs & use the edited source to deploy your application. (But this will add lots of maintenance issue)
The quickest way is to call the get details of api.
It will return the business information object as well as below:
"businessInformation": {
"technicalOwner": "John Doe",
"technicalOwnerEmail": "architecture#pizzashack.com",
"businessOwner": "Jane Roe",
"businessOwnerEmail": "marketing#pizzashack.com"
},
Here you will get the heavy response as it returns the complete swagger definition as well.

Where to Find Web Service of Delpoyed BPM in BPS Server in wso2?

I'm new to WSO2 products, I know while integrating BPS with ESB, we require the service of deployed Process
so My Question is:- Where to Find Web Service of Deployed BPM.
Deploying a BPM does not result in a Webservice, one or more processes will be deployed instead. You can find these under processes in the BPMN explorer https://[wso2server]:[port]/bpmn-explorer or they can be accessed through the BPMN rest API REST API Documentation.
If you want webservices that implement processes you should probably go with (WS-)BPEL. BPEL Reference
If you want to start/control the process from your webpage you can use the rest API. To start a process using the API you would send a POST request to the following URL:
https://<Host Name>:<Port>/bpmn/runtime/process-instances
This will create a new instance of the process you have specified in the Request body. All you need to put in the body to create the instance is either the processDefinitionId or processDefinitionKey (you can find both in the BPMN-explorer mentioned above). There are other, optional variables as well as the option to create your instance based on a message but this last option is not recommended.
{
   "processDefinitionKey":"sampleJavaServiceTask"
}
For more info on this, check out the link to the BPMN REST API

How to have multiple endpoints for one API in WSO2 API Manager?

Can I add multiple endpoints to 1 API in WSO2 Api Manager?
As far as I know I have to create a context and a version. The background is that I just want to make a request like https://api.manager.com/rest/1.0/userList or https://api.manager.com/rest/1.0/tasks.
The userList REST-Controller is implemented on backend A and tasks REST-Controller is implemented in backend B. (A and B are separate web applications)
As far as I know I have to create in my API Manager two APIs with different context values.
The API Manager application would simply subscribe both APIs.
But this would mean that I have to change my requests on the javascript side. This is in my opinion not good because I dont want my javascript application to care about the context. I want that the API Manager delegates to the correct backend automatically. Is this possible? What is best practise?
You can have multiple endpoints per API using Dynamic Endpoint Feature. When creating the API you need to set the Endpoint Type as "Dynamic Endpoint" and upload a mediation in-sequence that sets the "To" header. Within the sequence you can specify your logic to route to the correct endpoint (setting the correct "To" header) according to the request path. Please read [1] for more information.
[1] http://blog.lakmali.com/2016/08/dynamic-endpoints-in-wso2-api-manager.html

Wso2 API MANAGER WSDL security

I have downloaded the new version of API Manager 1.0.0 GA.
I am confused about publishing the WSDLs, since that has not a related API KEY, everyone can access it.
For that reason I have tried to add access token from ESB, but that will not authenticate the API Manager's Users (like Apisubscriber) only the users inside the ESB (even if I have configured an external JDBC db for both APIManager and ESB user-mgt.xml).
So, is there a way to create an API key for WSDLs as well from the API Manager? Or How do I control the access to the published WSDLs in the API store?
Many thanks
EDIT:
From the ESB I have added security to the service by using the built-in security scenarios, in my case I have used "UsernameToken". This authenticates users based on roles defined in the ESB "admin/everyone..." and only accepts users defined in the ESB's user store "admin/admin" (and others you might have created).
I have ESB and AM configured to share the same mysqlDB for user store, but that does not work in my Security Scenario described before: if I create a user "apicreator" inside AP and I create "usertest" inside ESB, they store the users inside the same MySQL db, but under different "tentant", i.e. "apicreator" is not a valid user to authenticate in my Security Scenario (UsernameToken). I hope this description helps to clarify the problem. thanks
With WSO2 API Manager, you couldn't control the access to a published WSDL in API Store.Currently there's no way of creating an API key for WSDLs as well from the API Manager.But that controlling has to be done through your back-end service. How-ever when creating an API from WSO2 API Manager ,giving the Wsdl url as an input is not a required field,but an optional field.
Apart from that I'm not clear about your following phrase."For that reason I have tried to add access token from ESB, but that will not authenticate the API Manager's Users (like Apisubscriber) only the users inside the ESB".Can you explain a bit more what you mean by "add access token from ESB"?
Thanks;
/Lalaji