Can a Application hosted on GAE reach local tomcat on my pc - rest

I have one application deployed on Google App Engine and another application hosted on my local machine on top of tomcat.
So my question is , can we reach the application on the tomcat ( App URL http://localhost:8080/xyz) from the Application which is hosted on Google App Engine.

App Engine applications can communicate with other applications or access other resources on the web by fetching URLs. An app can use the URL Fetch service to issue HTTP and HTTPS requests and receive responses. The URL Fetch service uses Google's network infrastructure for efficiency and scaling purposes.
So, yes, you can access your Tomcat application running on-premises using AppEngine's URLFetch class. It is available for all sandbox supported languages such as Python, Java and Go.
Here is simplified example with Python:
from google.appengine.api import urlfetch
url = "http://my-tomcat-app.com/"
result = urlfetch.fetch(url)
if result.status_code == 200:
doSomethingWithResult(result.content)

Related

Hosting REST api in web server or application server

I would like to know if there is any difference in hosting REST web service APIs in a web server or application server, is there any reason one is preferred over the other?
So i think you are confused about what are application servers and web servers.
Application Server is the name of a machine/server which is running any application used by an organization and it depends of any other servers to run the application functionalities correctly, like Database Servers, Caching Servers and other kind of servers.
Web server is a software which puts an application online for being accessed by clients through the web.
An application server commonly has a web server running inside it, as part of a stack needed to run the application in the server, like libraries and other sofwares need to execute the application objective.
So you can run a REST api inside of an application server with help of the web server application.
Some examples of web servers are Apache, Nginx, LightHttpd, etc.

Where to "host" a Progressive Web App (PWA)?

Im just starting out diving into PWAs.
Where should a PWA being published?
Can it be published like any other javascript app on the web (as a simple URL)?
A PWA is like any other website. You can host it anywhere you can host a "regular" site, as long as it is served via HTTPS.
A PWA is made up of service workers, which can run in the background. To avoid tampering with service workers the specification of PWA requires it to be hosted over HTTPS.
So any hosts supporting HTTPS would be good enough for them.

Standalone ServiceStack service for Web & Native Mobile App

Our architecture consists of several backend (non-ServiceStack) services and applications that send data to our system via ServiceStack service hosted in asp.net - this is currently a standalone ServiceProject project containing our required Services/Repository/DTOs following the structure of all the provided ServiceStack samples.
With our backend complete we're now designing our two front-end requirements consisting of a web application and native mobile application. For the web application I'd really like to continue leveraging ServiceStack by using the Razor plugin to create the application's layout/views from our existing DTOs, for our mobile app we will only rely on the ServiceStack service for authentication and data - as it is native it's layout/views will come from it's own SDK.
Can I leave my standalone ServiceStack service as is and:
Create a separate web application project that authenticates
against our existing standalone ServiceStack service and uses the
Razor view plugin?
Have our native mobile app clients
authenticate against the same standalone ServiceStack service?
Most of the examples ie. RazorRockstars I've seen have the services embedded in the web project so I'm not sure if this distributed type of setup is supported. Any guidance or feedback on this is greatly appreciated!
It is very much possible. You can consume the web service from both, web and native mobile application. I worked in a ASP.NET MVC web application which used to make call to Web API service hosted at different server. The Web API service was shared among multiple applications. We were consuming it by making AJAX calls from client.
Something similar to your scenario is done at below link but they are using cloud to host service:
http://www.codeproject.com/Articles/529109/Mobile-2fWebplusClient-2cplusWebplusAPIplusandplus
If you have opportunity to make a web app for mobile instead of native app, then in a single solution both mobile and desktop app can be created. The exemplary solution can be found here: http://nopcommerce.codeplex.com/
Thanks and free free to discuss more in case of further questions.

Developing backend Webservice and Database for iPhone App for Standalone person

I want to develop my iPhone app but I am not sure what could be the options I have for hosting database and webservice to communicate with my iPhone App. Could someone please suggest me what could be the best way to go for this?
I know how to build everything but never come across this situation. I have been working in environment where we ask Admin to give us Server where we host everything but if I want to do it myself and don't have server infrastructure what could be the options do I have? Do I need to purchase from web hosting provider?
Thanks.
From my experience, I've developed back-end part for iPad client. It was REST, ASP.NET Web API (WCF Web API) and as database on back-end MS SQL Server and MySQL.
Anyway for mobile clients you can freely use REST. It can be ASP.NET Web API from .NET or other libraries that help to make REST services for example from Java.
REST is good consumed by mobile client applications. And then from client application perspective, it's no matter what database back-end will have.
Speaking about hosting it also depends from requirements to back-end. When you have no server infrastructure, you can use cloud PaaS like Amazon AWS (EC2) for example. Or host server it by yourslef.

Web server vs App server

Is an application server something like an additional layer of application servicing above a web server?
Does an application server always have a web server as its core?
What is the difference?
No,Application server does not contain web server...
Read following articles...
http://www.answers.com/topic/application-server
http://download.oracle.com/docs/cd/E19159-01/819-3671/ablat/index.html
Basically:
After the Web exploded in the mid-1990s, application servers became Web based.
Also following shows the difference between web server, web container and application server...
Difference between a Web Server, Web Container, and an Application Server
A Web Server is a server capable of receiving HTTP requests, interpreting them, processing the corresponding HTTP Responses and sending them to the appropriate clients (Web Browsers). Example: Apache Web Server. Read more about Web Servers and their working>>
A Web Container is a J2EE compliant implementation which provides an environment for the Servlets and JSPs to run. Putting it differently we can say that a Web Container is combination of a Servlet Engine and a JSP Engine. If an HTTP Request refers to a Web Component (typically a Servlet or a JSP) then the request is forwarded to the Web Container and the result of the request is sent back to Web Server, which uses that result to prepare the HTTP Response for the particular HTTP Request. Example: Tomcat is a typical Web Container. A typical setup would be to have Apache HTTP Server as the Web Server and Tomcat as the Web Container.
An Application Server is a complete server which provides an environment for running the business components (EJBs, ADF BCs, etc.) in addition to providing the capabilities of a Web Container as well as of a Web Server. Example: Bea WebLogic, IBM WebSphere, Oracle
Application Server, etc.
Actually, with the explosion of the web, and in particular "web services", all modern App Servers can also function as Web Servers. For example, the current version of Tomcat includes built-in Web Server functionality so you no longer must run a separate Apache HTTP server. In the past, running separate dedicated Web Servers such as Apache was preferable since the App Server was optimized for App Server rather than for Web Server, processing; but the performance of App Servers as Web Servers has improved such that any remaining performance difference is irrelevant - and certainly does not justify the expense of running separate servers.
Today, the major difference is that an App Server is designed to support programming languages such as Java or, on the .net platform, C# - as well as to provide an underlying infrastructure that includes automatic fault-tolerance, session mgmt, transaction mgmt, multi-threading - and everything else required to build scalable enterprise applications. Current Web Servers are designed to support languages such as Ruby, PHP, Python and Perl - and lack the built-in infrastructure of an App Server.
However, the distinction between App Servers and Web Servers is blurring and will continue to do so as "Web Services" becomes ever-more popular and languages such as Ruby mature and therefore require Web Servers to provide much of the same underlying infrastructure as today's App Servers. In the end, the primary difference will be (not yet): if you want to develop the back-end (cloud) layer of your application employing Java or C#, employ an App Server; if you want to develop your application employing Ruby, PHP or Perl, employ a Web Server.
While a Web server mainly deals with
sending HTML for display in a Web
browser, an application server
provides access to business logic for
use by client application programs.
Read App server, Web server: What's the difference?