Best strategy to use rest web services behind VPN - java

I have an android app that would use certain restful service end point. Right now, the restful service is running on tomcat server and server machine is reachable after connecting to VPN.
My question is that
1. How to put the service machine so that it should be protected behind VPN and still, my app would be able to hit the service and get the result. The app is not having any coding related to connection through VPN. and the client is also not willing to remove VPN. So, how through PUBLIC IP or domain, I can plan to use the service in Android app.
I am not a android developer.
Thanks

Related

Add Java API to online server not localhost

I have just created a Hello World RESTful Java API with IntelliJ IDEA and Spring and I make several requests with http://localhost:8080/function and it works fine and return the JSON data well, but now I want to make request from my android app to get the same JSON data from another network. How to create global API or make my local API global or online?
If it is working on your PC, your next step is to host it somewhere which is reachable from the outside world. If it is still in testing mode, probably what you need to do is port-forwarding from your router, so that your requests to your public IP get forwarded to your PC.
In the long term of course you need to host it somewhere, unless you want to leave your PC running. You can buy a cheap hosting to start with on something like Digital Ocean, or go for the more advanced cloud service providers like Google and AWS.
in your router you have to redirect port 8080 to you network IP and allow port 8080 in your firewall
And use this IP address https://whatismyip.com.br/
You can create your java application in a container and deploy it on one of the cloud providers (AWS, Azure, Google App Engine).

Restrict Access to Web Server for Specific Devices

I have a web application running on Apache Tomcat and this Web Application runs on a server to which my Frontend connects. The Frontend's could be a Browser or and App that runs on Android or iOS.
I would now like to allow access to my Tomcat Web App only to specific devices that I device. Restricting access using IP address / MAC address might be the dumbest solution that I could think of, but that is doomed to fail given the diversity of the routers that could be inbetween the device and my Web App. So how do I potentially decide access to my Web App only to some specific devices?
I can see that Google already does this! I mean if I log in to my Google E-Mail account from a completely new device, it would prevent me from doing so and asks me for an authentication token from one of my trusted devices. Is there any AI or some funky Machine Learning happening behind the scenes at Google that actually checks for registered devices?
I would like to do the same to my Web Application running on Tomcat. So how do I do this? Any suggestions?

How to make a web service url work on a remote machine?

I have developed a REST based web service that works perfectly on my machine. The URL is
http://localhost:8080/MyRESTProject/resources/welcome/
Obviously, the URL would work only on my machine. What I want is the URL to work on any remote machine. Also, I want the service to run constantly. Is this possible even after I terminate the web service process?
PS: I am using eclipse dynamic web project to build this web service and the OS is windows 7.
Your web service will be available as long as it is being hosted. A web server receives HTTP requests and replies with HTTP responses. How can you expect your web service to continue working if you terminate the server process?
As for your web service being accessible from outside, you will need to know the public IP address of your network. You can search "What is my public IP" on Google search to get your answer.
But you are not done yet, you will need to configure your router/firewall to open up a port on your router and map it to port 8080 on your host.

Hosting an Application Server on App Engine?

I'm wondering if it is possible to host an Application Server on Google App Engine, I'm not planning to host a Web Application, but yes an App Server.
For example, hosting a Chat Server, that would Authenticate users log ins, register new users, establish a connection between two users running on clients developed to work with that Server.
If not, is there a similar service to GAE which I can use for that purpose.
Thanks a lot.
The XMPP and Channel APIs should let yo do it. If your client can make HTTP requests and your server can respond to them, then yes, you should be able to do it.
Yes this is possible.
Have a look at the Google Docs for an introduction to what the platform looks like and what APIs are available. And crucially what restrictions there are. For chat applications you might be interested in the Channel API.

DNS Error On BlackBerry Simulator and Phone

Hey all, having a little trouble here with connecting my application on BB. I'm using ksoap2 to call a java webservice i made running on GlassFish 3. On the simulator when i call this url
"http://equilibrio-120:8088/SocialVoiceServer/SocialServerWSService"
everything works well and it connects, the web service is currently running on my own computer. But if i append ";deviceside=true" to the url it will fail giving me a DNS Error. Anyone know why this happens?
"deviceside=true" tells the connection to use DirectTCP which goes over the cell phone carrier's network. Since the service is running on your local computer the blackberry will need to be connected to that network so append the URL with ";interface=wifi" to use your wi-fi network. Alternatively, you could host the web service somewhare that is accessible to the internet.

Categories

Resources