Comments (10)
Guys, Need help. Any pointers?
from product-apim.
Hi,
Have you tried out the official documentation for API Manager? see https://docs.wso2.com/display/AM1100/WSO2+API+Manager+Documentation. You could try out the tutorials as well in https://docs.wso2.com/display/AM200/Tutorials . In these tutorial https://docs.wso2.com/display/AM200/Create+and+Publish+an+API describes basics thing on how to expose a backend web service (in your case RESTful web service) using api manager. You could start from this tutorials first. Then you could dive in to more advanced stuff
Default WSO2 API manager provides OAuth token based authentication mechanism for rest apis. To Provide RBAC you can use scopes. This article (This is written for AM 1.9.1 but applicable for all API manager versions) http://wso2.com/library/articles/2015/12/article-role-based-access-control-for-apis-exposed-via-wso2-api-manager-using-oauth-2.0-scopes/ provides a sample on how to use scopes for access control mechanism.
Regarding Databases, Default API manager uses H2 database. but you can configure Mysql, Postgres , Oracle, mssql, databases as well. All the database scripts can be found in the pack. You could read about that in https://docs.wso2.com/display/AM200/Working+with+Databases. API manager database has user and permission related data, api related data, analytic data etc.
So I think you should go through the official API manger document and the tutorials first. that would help you to get some understanding of the product
Regards
Chamila
from product-apim.
Thank your for the link. I have read them.
I am getting it working if I deploy the WSO2 API gateway and our rest service inside the same WSO2 webserver (carbon, looks like this can be changed to Tomcat, Can this be changed to JETTY too ??)
But, my aim was to run the API gateway and my REST Service separate. The API gateway can just route the request to different REST Servers. For example say for URL1 go to REST Server 1, and for URL2 go to REST Server 2 etc. Is this supported? I am sure this must be. Could you please share some info on this topic, please.
Thanks a ton in advance.
Regards, Santos
from product-apim.
This is what I have tried till now. Not able to route the request via ws02 gateway yet.
Step1:
I have created a sample REST web service with below URL
http://172.16.241.3:8080/Jersey-Spring-Hibernate/rest/bookservice/getallbook ==> Gets list of books from SQL DB.
Step2:
I have copied this war file to below path
/home/santos/afn_asap/wso2am-2.0.0/repository/deployment/server/webapps/mywar.war?
Step3:
Created and published the new API.I have configured the API with below details. Need to validate this. Rest of the configuration looks straightforward.
- Remote end point:
/home/santos/afn_asap/wso2am-2.0.0/repository/deployment/server/webapps/mywar.war?
- Used only HTTP now.
Step3:
After subscribing for the API the request is sent with following parameters from the API manger console.
curl -X GET --header 'Accept: json' --header 'Authorization: Bearer ' 'http://172.16.241.3:9443/Jersey-Spring-Hibernate/rest/bookservice/getallbook/1.00/*'
Questions:
Couple of things looks wrong in the request. Need to figure out the root cause for the same.
a. 9443 looks to be HTTPS port. Default port for HTTP is 9763. I have created/published the API only with HTTP not sure why it sends HTTPS port.
b. The version gets appended in the URL. How to remove this.
I tried the same request from POSTMAN client with port 9763 which is the default HTTP port and it works.
URI from postman:
http://172.16.241.3:9763/Jersey-Spring-Hibernate/rest/bookservice/getallbook
Please let me know how to debug this ?
Or any logs you need to trouble shoot.
Kindly let me know.
Thanks.
Santos
from product-apim.
Hi,
Can you post this question in stackoverflow please? This way you could reach out to more people regarding your issue. Please tag with 'wso2-am'.
Regarding the questions
- Your remote endpoint is wrong. you have pointed to a file location as the remote endpoint. set it to http://172.16.241.3:9763/Jersey-Spring-Hibernate/rest/bookservice/getallbook .
When an API is fronted by API manager gateway, all the request should come to port 8243 or 8280. 9443 and 9763 are to access the web service directly. When you use the postman you are directly accessing the backend (http://172.16.241.3:9763/Jersey-Spring-Hibernate/rest/bookservice/getallbook )
To get the correct url. go to api store and go to the Overview section. It shows the correct url (ex http://172.17.0.1:8280/pizzashack/1.0.0)
If you want to remove the version from the url, there is a tick 'Make this the Default Version' you have to enable when creating the api. This is in the 'Manage' tab when creating the API in the publisher.
You can use wirelogs to debug the requests going in and out from the api manager. see http://mytecheye.blogspot.com/2013/09/wso2-esb-all-about-wire-logs.html. This method is applicable for API manager as well.
Again, Please use stackoverflow. :)
Regards
Chamila
from product-apim.
Thank you @chamilaadhi for your reply. As you might have seen I have started using stackoverflow now.
We tried few things but not able to route the request via gateway yet.
I can see some request logs in the gateway but it is not getting response from the production URL. One thing we suspect is our end URL is not secured. PLEASE LET ME KNOW IF THIS NEEDS TO BE ? I will generate the certificates and see if it helps. But, I am thinking I am missing somethings.
Configuration:
There are two URL's generated when the API is published. One for HTTPS & other for HTTP.
Gateway URL:
https://172.16.241.3:8243/Jersey-Spring-Hibernate/v1/rest/bookservice/getAllbook
http://172.16.241.3:8280/Jersey-Spring-Hibernate/v1/rest/bookservice/getAllbook
REST server URL
http://172.16.241.3:9763/ Jersey-Spring-Hibernate/v1/rest/bookservice/getAllbook
I tried with both HTTP & HTTPS gateway URL. Other option need to try is to enable the certificates for REST server so that end to end is secured.
I will post this question in stackoverflow to see if I get response. But, I would request if you could kindly quickly help me out in case you think what could be the problem.
Note: I will keep hunting the google & other open forums to figure out the gateway configuration issue.
Please let me know if you need any logs/configurations to debug this.
Thank you for your time.
Thanks
Santos
from product-apim.
I do not think it is related to certificate issue because your rest api is also hosted as a web app in API manager.
Enable wirelogs as mentioned in http://mytecheye.blogspot.com/2013/09/wso2-esb-all-about-wire-logs.html and do a request and attach the wirelog please.
from product-apim.
Thank you @chamilaadhi .
Itβs working now. Request is routed via gateway. Please accept my since thanks for the support.
Tested with CURL commands. Both HTTP & HTTPS is working.
Issues:
There were couple of issues in the setup
- Remote end point should end at the context.
http://172.16.241.3:9763/Jersey-Spring-Hibernate/v1 --> correct
http://172.16.241.3:9763/Jersey-Spring-Hibernate/v1/rest/ rest/bookservice/getAllbook - In the curl command the content type needs to be specified as JSON.
This one with direct access(will not be exposed to client)
curl -i -X GET -s "http://172.16.241.3:9763/Jersey-Spring-Hibernate/v1/rest/bookservice/getallbook"
This one works-->with http
curl --insecure -i -v -X GET --header 'Accept: application/json' --header 'Authorization: Bearer 83afd809-a1f0-31e1-b905-49b455bce7d9' 'http://172.16.241.3:8280/Jersey-Spring-Hibernate/v1/rest/bookservice/getallbook'
THis one works with https
curl --insecure -i -v -X GET --header 'Accept: application/json' --header 'Authorization: Bearer 83afd809-a1f0-31e1-b905-49b455bce7d9' 'https://172.16.241.3:8243/Jersey-Spring-Hibernate/v1/rest/bookservice/getallbook'
Having some issues with POSTMAN. I am figuring this out.
Also, do you know what should I do when my REST Server is not co-hosted. If you have any pointers kindly share.
Thank you.
Regards, Santos
from product-apim.
@chamilaadhi - What I feel deploying a REST Server outside should work. I am going to set this up and try. Is there anything difference ?
I guess, I can deploy the rest server in anywhere in the network and give the corresponding the URI when API is published.
Let us assume API gateway is running in 172.16.241.3. Production URI can be:
http://172.16.241.5/Jersey-Spring-Hibernate/v1
Need try this setup in our local lab. This will listen on the default HTTP port 8080.
Is this okay or anything else, I should be worried of?
Please let me know.
Thanks, Santos
from product-apim.
Please raise more concerns on [email protected].
from product-apim.
Related Issues (20)
- Need a detailed error message in UI when updating an invalid API definition HOT 1
- Visual bug with list of subscriptions in publisher HOT 2
- Not returning 401 for random access token for WS HOT 1
- Not capturing user IP when performing logout operation in admin portal HOT 2
- TokenType(user, application) identification in JWT claim in 4.0.0 HOT 1
- Access logs are not generated when using the ConfigurableLoggerAccessLogValve HOT 1
- Improve UI/UX related to Call Interceptor Service Policy by supporting an `Enum Array` input type
- Error message in the webhook API when trying to view subscriptions on the dev portal HOT 3
- Invalid policy gateway type when create new version of an API
- Invalid policy gateway type when import an exported API from apictl HOT 1
- Schema validation issue when content type is not application/json
- Template catalina-server.xml.j2 to Configure RemoteIpValve HOT 1
- Errors in editing OpenID Connect Configuration when IS-KM is configured HOT 1
- Backend URL is shown in Websocket error message
- WSO2 API Manager(wso2am-4.0.0) - Recurring JMS Error HOT 1
- [APIM-4.0.0] Migrated API documents are not getting displayed/listed on publisher HOT 1
- [APIM-4.0.0] Invalid username reference for TopicConnectionFactory url in jndi-cp.properties.j2
- Traffic Managers Scaling
- Unable to use Keycloak Key Manager for "Try Out Block" in WSO2 APIM dev-portal HOT 1
- Error when run <API-M_HOME>/dbscripts/mssql.sql "There is already an object named 'AM_APPLICATION_REGISTRATION' in the database."
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from product-apim.