使用 Google AppEngine 创建 Java Web 服务

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2216571/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 20:06:16  来源:igfitidea点击:

Creating Java Web Service using Google AppEngine

javaweb-servicesgoogle-app-engineservletswsdl

提问by Jeremy Edwards

I'm trying to create a simple web service application where I can retrieve a collection of strings and store them into a data store on the AppEngine server.

我正在尝试创建一个简单的 Web 服务应用程序,我可以在其中检索字符串集合并将它们存储到 AppEngine 服务器上的数据存储中。

I have knowledge in Java and barely any knowledge of Java Servlets and its WAR standards.

我有 Java 方面的知识,但对 Java Servlets 及其 WAR 标准几乎一无所知。

I would like to at least have some direction on how to create a web service using the Java technology AppEngine provides. I've searched but the articles are sparse and too lengthy while not providing any simple solutions.

我想至少对如何使用 AppEngine 提供的 Java 技术创建 Web 服务有一些指导。我已经搜索过,但文章稀疏且冗长,同时没有提供任何简单的解决方案。

I'd love it if I can create a web service using Java's annotations just like you can do in .NET with attributes.

如果我可以使用 Java 的注释创建 Web 服务,就像您在 .NET 中使用属性所做的那样,我会很高兴。

I'd appreciate links to articles and guidance a full source answer is not required but would be appreciated.

我很感激文章和指导的链接,不需要完整的源答案,但不胜感激。

No python based answers please.

请不要基于python的答案。

采纳答案by rochb

IMO, there is no simple solution to build a Web Service on GAE with Java.

IMO,没有使用 Java 在 GAE 上构建 Web 服务的简单解决方案。

But, it's still achievable. Let's start with the Web Serviceswe want to build.

但是,它仍然可以实现。让我们从我们想要构建的Web 服务开始。

In common usage the term refers to clients and servers that communicate over the Hypertext Transfer Protocol (HTTP) protocol used on the web. Such services tend to fall into one of two camps: Big Web Servicesand RESTful Web Services.

通常,该术语是指通过 Web 上使用的超文本传输​​协议 (HTTP) 协议进行通信的客户端和服务器。此类服务往往属于两大阵营之一:大型 Web 服务RESTful Web 服务

"Big Web Services" use SOAP/RPC format and RESTful Web Services use REST style one. You can read more about SOAP vs REST.

“Big Web 服务”使用 SOAP/RPC 格式,而 RESTful Web 服务使用 REST 风格一。您可以阅读有关 SOAP 与 REST 的更多信息

There are lots of Java open source Web Services frameworks out there. Most of them are generally based on the Java API for XML Web Services (JAX-WS), part of the Java EE platform. JAX-WS is not supportedby Google App Engine as specified in the list Will it play in App Engine. So forget about the "cool Java's annotations".

有很多Java 开源 Web 服务框架。它们中的大多数通常基于 Java API for XML Web Services (JAX-WS),它是 Java EE 平台的一部分。列表中指定的 Google App Engine不支持JAX-WS Will it play in App Engine。所以忘记“酷Java的注释”。

But, Restlet seems compatible with GAE. So if you think REST could be an option for you, I would go ahead and take a look at the Hello World tutorial of Restlet. Then, I'd go ahead and read the article on how to integrate Restlet with GAE.

但是,Restlet 似乎与 GAE 兼容。因此,如果您认为 REST 可能是您的一个选择,我会继续查看RestletHello World 教程。然后,我会继续阅读有关如何将 Restlet 与 GAE 集成的文章。