简体   繁体   English

如何在Java中构建(也用于Web服务的URL),部署和使用Web服务

[英]how to build(url for web services also), deploy and use web services in java

i have a server with oracle database for which i have to make web services. 我有一台带有oracle数据库的服务器,必须为其提供Web服务。 i searched a lot but didn't got a perfect solution from starting means building web service of URL having simple parameters and json parameters also. 我进行了大量搜索,但从开始就没有一个完美的解决方案,即构建具有简单参数和json参数的URL Web服务。 and then giving response of json. 然后给出json的响应。 please tell me if i am sitting in front of my server then from where i have to start and what to do from start to end. 请告诉我我是否坐在服务器前,然后从哪里开始以及从头到尾做什么。 i have to use it in android apps. 我必须在Android应用程序中使用它。 please i am in trouble. 请给我麻烦。 because i never build web service before. 因为我以前从未构建过Web服务。 thanx in advance. 提前谢谢。

There are two ways to write web services in java 用Java编写Web服务有两种方法

  1. SOAP- Simple object access protocol SOAP-简单对象访问协议
  2. Restful web service. 宁静的Web服务。
    Both have their own advantages and disadvantages. 两者都有各自的优点和缺点。 But personally I think writing a restful web service is good. 但是我个人认为编写一个宁静的Web服务是很好的。
    This may help you: Compare and contrast REST and SOAP web services? 这可能对您有帮助: 比较和对比REST和SOAP Web服务?

SOAP is based on XML. SOAP基于XML。 The messages are transmitted via XML format. 消息通过XML格式传输。 You will have to create both server side and client side. 您将必须同时创建服务器端和客户端。 After creating the server side implementation you have to create a wsdl file for the client to access. 创建服务器端实现后,您必须创建一个wsdl文件供客户端访问。 Writing the client side is also simple. 编写客户端也很简单。
This link may help you: 此链接可以帮助您:
Introductory JAX-WS tutorial for Eclipse using a top down approach 使用自上而下方法的Eclipse入门JAX-WS教程

Restful web services are URL based. 宁静的Web服务基于URL。 This will be better for your purpose. 这将更好地满足您的目的。 and it is easy to implement when compared to SOAp. 与SOAp相比,它很容易实现。
This link may help you 此链接可能对您有帮助
http://docs.oracle.com/cd/E19226-01/820-7627/giqbx/index.html http://docs.oracle.com/cd/E19226-01/820-7627/giqbx/index.html

For server side : Web-service : Is just a way of exposing your methods on web service . 对于服务器端:Web服务:只是在Web服务上公开方法的一种方法。 As KonZa said there are two types of web-service and u can choose any one of them . 正如KonZa所说,网络服务有两种,您可以选择其中一种。 For starter i would prefer you to check this site : http://netbeans.org/kb/docs/websvc/jax-ws.html which will teach you how to make web-service and publish them . 首先,我希望您访问以下站点: http : //netbeans.org/kb/docs/websvc/jax-ws.html ,它将教您如何制作Web服务并发布它们。

Client Side : For Android , your job is pretty simple : Check SO or web for how use KSOAP2 Library which is used for communicating with webservice in android . 客户端:对于Android,您的工作非常简单:检查SO或Web,了解如何使用KSOAP2库与android中的Web服务进行通信。

For all this you just need to have strong java base . 对于所有这些,您只需要具有强大的Java基础。
Let me know if you have any other query . 让我知道您是否还有其他疑问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM