The difference between a portlet and a web service

I'm not sure if I compare onions with cabbage. But I'm really confused by the portlet and web service. I know that a web service turns your software components into your application as a service for other applications, but for me it looks like a portlet that meets the needs. I know that my understanding makes you (Portlet and SAAS developers) very upset. But I need clarity in this.

Why can't I use a portlet request response similar to a web service? If so, what is the benefit that I get from using a web service than a portlet? If not, which portlets should not act as a web service?

I am new to portlet development. Please do not curse me for this question.

Please offer.

EDIT: Most of the answers say that the portlet is a user interface component. My client asked me to create a web service in liferay. So make a portlet as a web service? If so, can you provide a pointer or code snippet?

+2
source share
3 answers

Addressing your "editing" specifically with respect to Liferay ...

Liferay plug-in projects can expose web services without too much difficulty.

Liferay Service Builder does have the tools to create SOAP web services or JSON web services that are supported by tables in the Liferay database (and which query in existing database tables). In the case of JSON web services, the URL scheme created is not RESTful (unfortunately), but it is well defined. With a bit of work on your part, you can also impose a Liferay permission system on web service calls.

Here's a reasonable starting point in the Liferay Developer Guide :

See the links on this page for SOAP and JSON.

Note that a portlet is only one type of Liferay plugin. The web service tool is part of a service layer that can be used by many types of plugins. Thus, not necessarily the portlet associated with creating a web service in Liferay, you can create a web service that is not associated with a visual component.

+2
source

Portlets are areas that you create to add and display content. Portlets can be added left and right of the central area of ​​the body and can contain a myriad of content, ranging from news, events, calendars, RSS feeds, collections, plain text, etc. In addition, you can set properties and policies for displaying portlets.

you want to use the portlet when you have content that you want to focus on, such as news. You need to provide configuration data for the item. - that is, the number of entries to display. You want to give content editors a choice about when and where to display content. You want to show this only to some groups or users.

Web Services, on the other hand:

  • Allows applications to provide their services β€œprogammatically”, that is, services can be called by programs

  • Includes software running on other computers (may be a desktop, mobile phone, PDA, etc.) for invoking operations opened by web applications

if you are trying to determine the historical portal of the main differences, portlets have three levels of architechture (client, middle level, backend), this causes two weaknesses:

  • Different portal groups do not have a well-established way of sharing services.
    • Various technologies (Java, Perl, CORBA, EJB) at the middle level.
    • Various protocols (GRAM, IIOP, ...)
  • Consequently, a lot of redundancy, rethinking
    • Example: batch script generation

therefore, web services solve the problem of sharing services and reduce redundancy.

source1 source2 source3

+1
source

Portlets must be a user interface component in a portal solution.

Web services provide functionality for remotely interacting with a system that typically uses SOAP, REST, JMS, or other related

They provide completely separate functions. The closest you get is the serveResource in portlets. This function is used to serve various types of content from a portlet (such as a PDF document or an AJAX response) without having to complete a full page request.

0
source

Source: https://habr.com/ru/post/1502067/


All Articles