简体   繁体   中英

Most important uses of web service

Web services are used to share the services provided by an application, to outside world. This is my basic understanding of web services.

Suppose my application is to expose some specific behaviors and I have written the code for it and exposed the methods. The ones who want to use it can take the link to the wsdl, generate stub and call the methods.

What is the use of doing all this, when I can myself expose the methods, generate a jar and bundle everything in it and share the server address,jar.

How differently is web services important, when compared to a case explained above. Am asking such a general question due to unsuccessful search in many websites.

If you'd generate a client jar, whoever wants to use that would have to deal with Java. If you expose a Web Service instead, the user can use whatever technology he/she wants to use (eg Python, Ruby, .net, C, C++ etc. etc.). That would be a huge advantage.

What you are suggesting is quite close to RESTful webservices. Unlike SOAP webservices, RESTful webservices do not require any WSDL files. All that you need to do is to issue a request to a particular URL.

As you explained correctly (in my opinion) SOAP webservices involve some more work which needs to be done, thus making them more complex, if you will, to integrate with other systems. This is not the case with RESTful webservices.

EDIT: You can check out a tutorial here . I have tried it myself a while back and it is enough to get you started.

Web服务使用一系列标准(SOAP,WSDL ...)使不同类型的系统协同工作,当然您可以根据需要生成客户端jar,但这需要您的服务使用者学习如何使用它,因此不是通用的解决方案。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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