如何通过使用PostgreSQL的Apache Tomcat Java创建Web服务 [英] How to create webservice in java using apache tomcat using PostgreSQL

查看:235
本文介绍了如何通过使用PostgreSQL的Apache Tomcat Java创建Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何创建Web服务。我是一个Android开发者。哪种方法适用于Android的Web服务,其实我们正在使用服务器端的Apache Tomcat PostgreSQL中,所以请给我这个问题的任何想法。

I want to know how to create web service. I am an android developer. Which method is suitable in android web services, actually we are using server side apache tomcat in PostgreSQL so please give me any ideas about this issues

推荐答案

presuming由网络服务你的意思是目前最常用的方法之一,REST风格的HTTP + JSON或HTTP + XML,你可能要使用 JAX-RS (的 JSR311 )。这是的Java EE 的规范,和最容易的方法的一部分要不断前进是只使用 JBoss AS中7 捆绑了它。 JAX-RS的实现也很容易,如果你preFER的Tomcat和Tomcat使用。你想 RestEasy的或的泽西;或者应该罚款。查看的Java EE教程JAX-RS 中的< A HREF =htt​​p://jersey.java.net/nonav/documentation/latest/user-guide.html#d4e8相对=nofollow>新泽西入门指南和的 RestEasy的文档

Presuming that by "web service" you mean one of the most common methods currently used, REST-style HTTP+JSON or HTTP+XML, you probably want to use JAX-RS (JSR311). This is part of the Java EE specification, and the easiest way to get going is to just use JBoss AS 7 which bundles it. JAX-RS implementations are also easy to use with Tomcat if you prefer Tomcat. You want RESTEasy or Jersey; either should be fine. Check out the Java EE tutorial for JAX-RS, the Jersey getting started guide, and the RESTEasy documentation.

如果,事实上,你想一些其他类型的网络服务像 XML-RPC SOAP 或的 CORBA (编辑:为您的文章标签提示),那么(一)重新考虑,他们被所取代的原因和(b)如果必须使用它们,看看实现具体到您必须使用绑定技术。我建议您检查 JAX-WS 以SOAP + WSDL,但我没有使用过它自己,所以我没有什么进一步的提供。我知道 NetBeans IDE中提供一些老派的SOAP / JAX-WS Web服务的支持,但同样没有看着它。

If, in fact, you want some other kind of web service like XML-RPC, SOAP or CORBA (edit: as your post tags suggest), then (a) reconsider, they're being superceded for a reason and (b) if you must use them, look into implementations specific to the binding technology you must use. I'd suggest that you examine JAX-WS for SOAP+WSDL, but I haven't worked with it myself so I have nothing further to offer. I know the NetBeans IDE offers some kind of old-school SOAP/JAX-WS web services support, but again haven't looked into it.

我希望这将是比较容易的方式与Android中JAX-RS的工作比将与SOAP工作。 JAX-RS客户端不需要任何东西比HTTP客户端库和XML或JSON解析器/作家更多 - 尽管存在针对REST风格的API客户端库和使他们更容易的工作。

I expect it'll be way easier to work with JAX-RS in Android than it will be to work with SOAP. A JAX-RS client doesn't need to be anything more than a HTTP client library and an XML or JSON parser/writer - though client libraries that target REST-style APIs exist and make them even easier to work with.

你真的需要SOAP?或者你只是需要任何一种基于Web的客户端/服务器通信的?究竟什么是你想实现这个?哪里PostgreSQL的进入呢?

Do you really need SOAP? Or do you just need any kind of web based client/server communication? What exactly are you trying to achieve with this? Where does PostgreSQL come into it?

这篇关于如何通过使用PostgreSQL的Apache Tomcat Java创建Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆