SlideShare a Scribd company logo
1 of 17
Download to read offline
JAX-WS e JAX-RS
Come sviluppare servizi SOAP e REST in standard JAX-WS e
JAX-RS su Liferay
Antonio Musarra, Software e Architectural Consultant, Key-Biz Srl
@antonio_musarra
Antonio Musarra (@antonio_musarra)
Software e Architectural Consultant, Key-Biz Srl
Web: http://www.key-biz.it
Blog: http://www.dontesta.it/blog
GitHub: https://github.com/amusarra
SlideShare: http://www.slideshare.net/amusarra
Ho iniziato il mio viaggio nel mondo dell'informatica da un Olivetti M24 dotato di un
processore Intel 8086 acquistato da mio padre esclusivamente per il suo lavoro. Non ho mai
posseduto console di nessun genere (Commodore, Amiga, etc…) e inizialmente
quell'enorme scatola mi terrorizzava, terrore durato poco; giorno dopo giorno prendevo
rapidamente il controllo fino a quando….
Ho sempre creduto che la condivisione della conoscenza sia un ottimo mezzo per la crescita
personale e questo è stato uno dei principali motivi che mi ha spinto sei anni fa a creare il
mio blog personale www.dontesta.it
Dicono di me che sono bravo nell'analizzare e risolvere rapidamente i problemi complessi.
La mia attività odierna è quella di consulente in progetti enterprise che utilizzano tecnologie
Web Oriented come J2EE, Web Services, ESB, TIBCO.
Java standard per Web Service
JAX-WS (Java API for XML Web Services): è un insieme di API Java dedicate allo
sviluppo di servizi web. L'insieme fa parte della piattaforma Java EE. JAX-WS usa
annotazioni per semplificare lo sviluppo e le implementazioni di client. JAX-WS include
Java Architecture for XML Binding (JAXB) e SOAP.
@antonio_musarra
JAX-RS (Java API for RESTful): è un insieme di API Java dedicate allo sviluppo di
servizi web in base al pattern architetturale Representational State Transfer (REST).
L'insieme fa parte della piattaforma Java EE. JAX-RS usa annotazioni per semplificare lo
sviluppo e le implementazioni di client.
Liferay Web Service
• La generazione e l’invocazione dei servizi web è una parte centrale della esperienza di
sviluppo Liferay
• Liferay senza servizi web sarebbe come una macchina di lusso senza ruote.
• Fortunatamente, Liferay è dotato di una serie completa di servizi JSON e SOAP che
espongo tutte le funzionalità core.
• Liferay offre anche il framework (Service Builder) per generare servizi locali e remoti
per le tue applicazioni.
@antonio_musarra
Standard JAX-WS e JAX-RS
@antonio_musarra
• Dalla versione 7 Liferay supporta i due standard java per i servizi web JAX-WS e
JAX-RS
• L’implementazione dei due standard JAX-WS e JAX-RS che Liferay ha deciso di
adottare è Apache CXF
• Ogni Apps può pubblicare i servizi web su endpoint Apache CXF definiti sulla propria
istanza Liferay
• Gli endpoint Apache CXF sono effettivamente percorsi di contesto (o context path)
dei servizi web dove vengono distribuiti e resi accessibili
• E’ possibile definire sulla propria istanza Liferay uno o più endpoint Apache CXF
• Per accedere ai servizi web, un extender deve essere configurato nell'istanza Liferay
Liferay SOAP e REST Extender
@antonio_musarra
Gli Extenders specificano dove i servizi vengono distribuiti
e se hanno handler, filter, provider, etc. Ci sono due tipi di
extender:
• SOAP Extenders: Richiesto per la pubblicazione di
servizi web JAX-WS in grado di distribuire su uno o più
endpoint CXF con la possibilità di configurare handler,
filter, provider, etc.
• REST Extenders: Richiesto per la pubblicazione di
servizi web JAX-RS e offre servizi analoghi
all’extender SOAP.
JAX WS API
JSR-224
JAX RS API
JSR-370
Apache CXF
(v. 3.0.3)
Liferay
SOAP Extender
Liferay
REST Extender
My Liferay 7 App
Rest Service SOAP Service
Liferay SOAP e REST Extender
@antonio_musarra
• I SOAP e REST Extender sono dei sottosistemi che tracciano i servizi corrispondenti
ai filtri OSGi specificati in configurazione e li distribuiscono sotto a specifici endpoint
CXF
• Tramite i filtri OSGi posso istruire gli extender per registrare non solo i servizi web
REST e SOAP ma anche per indicare quali sono i componenti che implementano gli
eventuali handler, filter e provider
• Gli endpoint CXF per entrambi i tipi di extender possono essere creati a livello di
codice o tramite il Pannello di controllo di Liferay
Liferay SOAP e REST Extender
@antonio_musarra
Per ogni extenders abbiamo
la possibilità di
configurare ogni
elemento tramite Pannello
di controllo Liferay o per
via programmatica
attraverso l’indicazione
sul file bnd di quale sia il
file di configurazione da
adottare per il bundle che
contiene i servizi web.
Pubblicazione dei servizi JAX-RS
@antonio_musarra
È possibile pubblicare un servizio web JAX-RS che risiede all’interno di un modulo
Liferay così come si farebbe al di fuori di Liferay. A seguire l’esempio di un servizio.
Pubblicazione dei servizi JAX-WS
@antonio_musarra
È possibile pubblicare un servizio web JAX-WS che risiede all’interno di un modulo
Liferay così come si farebbe al di fuori di Liferay. A seguire l’esempio di un servizio
Costruiamo un progetto d’esempio
@antonio_musarra
Supponiamo che un sistema esterno abbia bisogno di accedere ad un set di dati che
risiedono su Liferay attraverso un set di API semplici esposte via JAX-RS e JAX-WS.
Come procedere?
• Definire l’insieme d’interfacce, quindi il set di API
• Implementare l’insieme d’interfacce come servizi locali
• Implementare l’endpoint JAX-RS per i servizi web REST
• Implementare l’endpoint JAX-WS per i servizi web SOAP
• Configurare gli Extender SOAP e REST sull’instanza di Liferay
Costruiamo un progetto d’esempio
@antonio_musarra
Il progetto Liferay è organizzato in moduli distribuiti così come indicato nella mappa e ogni
modulo è poi i realtà un bundle OSGi che andrà installato sull’istanza Liferay. La nostra
istanza Liferay conterrà quindi quattro bundle OSGi.
Costruiamo un progetto d’esempio
@antonio_musarra
I due bundle rappresentano i due endpoint JAX-RS e JAX-WS che implementano le API
definite dal modulo Custom User Service API. In figura sono evidenti gli endpoint CXF e i
filtri OSGi che consento agli extender la registrazione come servizi.
Costruiamo un progetto d’esempio
@antonio_musarra
Nel class diagram sono indicate le interfacce e le implementazioni dei servizi locali e remoti
esposti come endpoint JAX-WS e JAX-RS
Deploy e test dei servizi
@antonio_musarra
Dopo il deploy del progetto abbiamo attivi i quattro bundle OSGi, così come visibile nella
figura a seguire (esecuzione del comando lb | grep Custom). Da questo momento i servizi
web sono disponibili.
Gli endpoint dei servizi web (sulla propria istanza Liferay) sono:
• http://localhost:8080/o/rest/ext.persons
• http://localhost:8080/o/web-services/CustomUserServiceWSEndPoint
Deploy e test dei servizi
@antonio_musarra
In figura l’esempio un esempio di
chiamata al servizio web JAX-RS appena
installato. La chiamata è stata eseguita
tramite il comando curl.
curl -v
http://localhost:8080/o/rest/ext.persons
/list/tag/it-architect | prettyjson
In questo caso il servizio restituisce i
contatti Liferay che sono taggati con il
valore it-architect.
Ci vediamo al prossimo Symposium
@antonio_musarra
…Però, se siete curiosi di scoprire di più su Liferay 7:
• http://www.dontesta.it/blog
• http://www.slideshare.net/amusarra
• https://github.com/amusarra
• https://dev.liferay.com
…e nel frattempo scaricate l’intero progetto da https://github.com/amusarra/liferay-web-
services-jaxwsrs
Antonio Musarra
@antonio_musarra
Grazie!

More Related Content

What's hot

Example for configuring local attack defense
Example for configuring local attack defenseExample for configuring local attack defense
Example for configuring local attack defenseHuanetwork
 
서버리스 데이터 플로우 개발기 - 김재현 (Superb AI) :: AWS Community Day 2020
서버리스 데이터 플로우 개발기 - 김재현 (Superb AI) :: AWS Community Day 2020서버리스 데이터 플로우 개발기 - 김재현 (Superb AI) :: AWS Community Day 2020
서버리스 데이터 플로우 개발기 - 김재현 (Superb AI) :: AWS Community Day 2020AWSKRUG - AWS한국사용자모임
 
Microservices
MicroservicesMicroservices
MicroservicesSmartBear
 
On prem to cloud hub migration (updated)
On prem to cloud hub migration (updated)On prem to cloud hub migration (updated)
On prem to cloud hub migration (updated)Sandeep Deshmukh
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...Jitendra Bafna
 
ONOS: Open Network Operating System. An Open-Source Distributed SDN Operating...
ONOS: Open Network Operating System. An Open-Source Distributed SDN Operating...ONOS: Open Network Operating System. An Open-Source Distributed SDN Operating...
ONOS: Open Network Operating System. An Open-Source Distributed SDN Operating...ON.LAB
 
Containerizing MuleSoft applications for hybrid deployment
Containerizing MuleSoft applications for hybrid deployment Containerizing MuleSoft applications for hybrid deployment
Containerizing MuleSoft applications for hybrid deployment JuliaDemidova3
 
The Architecture of an API Platform
The Architecture of an API PlatformThe Architecture of an API Platform
The Architecture of an API PlatformJohannes Ridderstedt
 
IoT at scale - Monitor and manage devices with AWS IoT Device Management - SV...
IoT at scale - Monitor and manage devices with AWS IoT Device Management - SV...IoT at scale - Monitor and manage devices with AWS IoT Device Management - SV...
IoT at scale - Monitor and manage devices with AWS IoT Device Management - SV...Amazon Web Services
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafkaemreakis
 
Presentation, Firewalls
Presentation, FirewallsPresentation, Firewalls
Presentation, Firewallskkkseld
 
MuleSoft Nashik Meetup#5 - JSON Logger and Externalize Logs
MuleSoft Nashik Meetup#5 - JSON Logger and Externalize LogsMuleSoft Nashik Meetup#5 - JSON Logger and Externalize Logs
MuleSoft Nashik Meetup#5 - JSON Logger and Externalize LogsJitendra Bafna
 
Opentracing jaeger
Opentracing jaegerOpentracing jaeger
Opentracing jaegerOracle Korea
 
Building a Dynamic Rules Engine with Kafka Streams
Building a Dynamic Rules Engine with Kafka StreamsBuilding a Dynamic Rules Engine with Kafka Streams
Building a Dynamic Rules Engine with Kafka StreamsHostedbyConfluent
 

What's hot (20)

Load balancer in mule
Load balancer in muleLoad balancer in mule
Load balancer in mule
 
Example for configuring local attack defense
Example for configuring local attack defenseExample for configuring local attack defense
Example for configuring local attack defense
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Message Broker System and RabbitMQ
Message Broker System and RabbitMQMessage Broker System and RabbitMQ
Message Broker System and RabbitMQ
 
서버리스 데이터 플로우 개발기 - 김재현 (Superb AI) :: AWS Community Day 2020
서버리스 데이터 플로우 개발기 - 김재현 (Superb AI) :: AWS Community Day 2020서버리스 데이터 플로우 개발기 - 김재현 (Superb AI) :: AWS Community Day 2020
서버리스 데이터 플로우 개발기 - 김재현 (Superb AI) :: AWS Community Day 2020
 
Microservices
MicroservicesMicroservices
Microservices
 
On prem to cloud hub migration (updated)
On prem to cloud hub migration (updated)On prem to cloud hub migration (updated)
On prem to cloud hub migration (updated)
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
 
ONOS: Open Network Operating System. An Open-Source Distributed SDN Operating...
ONOS: Open Network Operating System. An Open-Source Distributed SDN Operating...ONOS: Open Network Operating System. An Open-Source Distributed SDN Operating...
ONOS: Open Network Operating System. An Open-Source Distributed SDN Operating...
 
Containerizing MuleSoft applications for hybrid deployment
Containerizing MuleSoft applications for hybrid deployment Containerizing MuleSoft applications for hybrid deployment
Containerizing MuleSoft applications for hybrid deployment
 
The Architecture of an API Platform
The Architecture of an API PlatformThe Architecture of an API Platform
The Architecture of an API Platform
 
IoT at scale - Monitor and manage devices with AWS IoT Device Management - SV...
IoT at scale - Monitor and manage devices with AWS IoT Device Management - SV...IoT at scale - Monitor and manage devices with AWS IoT Device Management - SV...
IoT at scale - Monitor and manage devices with AWS IoT Device Management - SV...
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Terraform
TerraformTerraform
Terraform
 
Presentation, Firewalls
Presentation, FirewallsPresentation, Firewalls
Presentation, Firewalls
 
REST API Design
REST API DesignREST API Design
REST API Design
 
Spring Cloud Gateway
Spring Cloud GatewaySpring Cloud Gateway
Spring Cloud Gateway
 
MuleSoft Nashik Meetup#5 - JSON Logger and Externalize Logs
MuleSoft Nashik Meetup#5 - JSON Logger and Externalize LogsMuleSoft Nashik Meetup#5 - JSON Logger and Externalize Logs
MuleSoft Nashik Meetup#5 - JSON Logger and Externalize Logs
 
Opentracing jaeger
Opentracing jaegerOpentracing jaeger
Opentracing jaeger
 
Building a Dynamic Rules Engine with Kafka Streams
Building a Dynamic Rules Engine with Kafka StreamsBuilding a Dynamic Rules Engine with Kafka Streams
Building a Dynamic Rules Engine with Kafka Streams
 

Viewers also liked

Liferay - Quick Start 1° Episodio
Liferay - Quick Start 1° EpisodioLiferay - Quick Start 1° Episodio
Liferay - Quick Start 1° EpisodioAntonio Musarra
 
Introduzione ai sistemi di Content Management System (CMS)
Introduzione ai sistemi di Content Management System (CMS)Introduzione ai sistemi di Content Management System (CMS)
Introduzione ai sistemi di Content Management System (CMS)Antonio Musarra
 
Moved to https://slidr.io/azzazzel/liferay-7-microservices-for-the-enterprise
Moved to https://slidr.io/azzazzel/liferay-7-microservices-for-the-enterpriseMoved to https://slidr.io/azzazzel/liferay-7-microservices-for-the-enterprise
Moved to https://slidr.io/azzazzel/liferay-7-microservices-for-the-enterpriseMilen Dyankov
 
Corso introduttivo di Design Pattern in Java per Elis - 1
Corso introduttivo di Design Pattern in Java per Elis - 1Corso introduttivo di Design Pattern in Java per Elis - 1
Corso introduttivo di Design Pattern in Java per Elis - 1Antonio Musarra
 
Carbon: Towards a Server Building Framework for SOA Platform
Carbon: Towards a Server Building Framework for SOA PlatformCarbon: Towards a Server Building Framework for SOA Platform
Carbon: Towards a Server Building Framework for SOA PlatformSrinath Perera
 
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi StyleLiferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi StyleAntonio Musarra
 
Jax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 PlatformJax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 PlatformWSO2
 
AWS for the Java Developer
AWS for the Java DeveloperAWS for the Java Developer
AWS for the Java DeveloperRory Preddy
 
Integrazione Sistemi CRM (Joomla) & CRM (SugarCRM)
Integrazione Sistemi CRM (Joomla) & CRM (SugarCRM)Integrazione Sistemi CRM (Joomla) & CRM (SugarCRM)
Integrazione Sistemi CRM (Joomla) & CRM (SugarCRM)Antonio Musarra
 
Design patterns - parte 1
Design patterns - parte 1Design patterns - parte 1
Design patterns - parte 1Fabio Armani
 
Porte aperte sul web e CMS per la scuola
Porte aperte sul web e CMS per la scuolaPorte aperte sul web e CMS per la scuola
Porte aperte sul web e CMS per la scuolaAlberto Ardizzone
 
Cms, Content Management System. Sistema di gestione dei contenuti
Cms, Content Management System. Sistema di gestione dei contenutiCms, Content Management System. Sistema di gestione dei contenuti
Cms, Content Management System. Sistema di gestione dei contenutiGiulia S
 
Mapping the Value (Agilia Budapest 2016)
Mapping the Value (Agilia Budapest 2016)Mapping the Value (Agilia Budapest 2016)
Mapping the Value (Agilia Budapest 2016)Fabio Armani
 
Approfondimento accessibilità
Approfondimento accessibilitàApprofondimento accessibilità
Approfondimento accessibilitàLorella Medori
 
Advanced liferay architecture clustering and high availability
Advanced liferay architecture clustering and high availabilityAdvanced liferay architecture clustering and high availability
Advanced liferay architecture clustering and high availabilityBordin Kijsirijareonchai
 

Viewers also liked (20)

OSGi e Liferay 7
OSGi e Liferay 7OSGi e Liferay 7
OSGi e Liferay 7
 
Liferay - Quick Start 1° Episodio
Liferay - Quick Start 1° EpisodioLiferay - Quick Start 1° Episodio
Liferay - Quick Start 1° Episodio
 
Introduzione ai sistemi di Content Management System (CMS)
Introduzione ai sistemi di Content Management System (CMS)Introduzione ai sistemi di Content Management System (CMS)
Introduzione ai sistemi di Content Management System (CMS)
 
Moved to https://slidr.io/azzazzel/liferay-7-microservices-for-the-enterprise
Moved to https://slidr.io/azzazzel/liferay-7-microservices-for-the-enterpriseMoved to https://slidr.io/azzazzel/liferay-7-microservices-for-the-enterprise
Moved to https://slidr.io/azzazzel/liferay-7-microservices-for-the-enterprise
 
Corso introduttivo di Design Pattern in Java per Elis - 1
Corso introduttivo di Design Pattern in Java per Elis - 1Corso introduttivo di Design Pattern in Java per Elis - 1
Corso introduttivo di Design Pattern in Java per Elis - 1
 
Carbon: Towards a Server Building Framework for SOA Platform
Carbon: Towards a Server Building Framework for SOA PlatformCarbon: Towards a Server Building Framework for SOA Platform
Carbon: Towards a Server Building Framework for SOA Platform
 
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi StyleLiferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
Liferay 7: Come realizzare un client SOAP con Apache CXF in OSGi Style
 
Jax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 PlatformJax WS JAX RS and Java Web Apps with WSO2 Platform
Jax WS JAX RS and Java Web Apps with WSO2 Platform
 
AWS for the Java Developer
AWS for the Java DeveloperAWS for the Java Developer
AWS for the Java Developer
 
Liferay e Modularização com Arquitetura OSGi
Liferay e Modularização com Arquitetura OSGiLiferay e Modularização com Arquitetura OSGi
Liferay e Modularização com Arquitetura OSGi
 
Integrazione Sistemi CRM (Joomla) & CRM (SugarCRM)
Integrazione Sistemi CRM (Joomla) & CRM (SugarCRM)Integrazione Sistemi CRM (Joomla) & CRM (SugarCRM)
Integrazione Sistemi CRM (Joomla) & CRM (SugarCRM)
 
Design patterns - parte 1
Design patterns - parte 1Design patterns - parte 1
Design patterns - parte 1
 
Polyglot
PolyglotPolyglot
Polyglot
 
Introduzione al Web 2.0
Introduzione al Web 2.0Introduzione al Web 2.0
Introduzione al Web 2.0
 
Porte aperte sul web e CMS per la scuola
Porte aperte sul web e CMS per la scuolaPorte aperte sul web e CMS per la scuola
Porte aperte sul web e CMS per la scuola
 
Cms, Content Management System. Sistema di gestione dei contenuti
Cms, Content Management System. Sistema di gestione dei contenutiCms, Content Management System. Sistema di gestione dei contenuti
Cms, Content Management System. Sistema di gestione dei contenuti
 
Mapping the Value (Agilia Budapest 2016)
Mapping the Value (Agilia Budapest 2016)Mapping the Value (Agilia Budapest 2016)
Mapping the Value (Agilia Budapest 2016)
 
Approfondimento accessibilità
Approfondimento accessibilitàApprofondimento accessibilità
Approfondimento accessibilità
 
07 - Web apps e CMS
07 - Web apps e CMS07 - Web apps e CMS
07 - Web apps e CMS
 
Advanced liferay architecture clustering and high availability
Advanced liferay architecture clustering and high availabilityAdvanced liferay architecture clustering and high availability
Advanced liferay architecture clustering and high availability
 

Similar to JAX-WS e JAX-RS

Set up and management of an integrated information system on Linux.
Set up and management of an integrated information system on Linux.Set up and management of an integrated information system on Linux.
Set up and management of an integrated information system on Linux.Andrea Marchetti
 
Set up and management of an integrated information system on Linux.
Set up and management of an integrated information system on Linux.Set up and management of an integrated information system on Linux.
Set up and management of an integrated information system on Linux.Andrea Marchetti
 
Sviluppo di servizi REST per Android - Luca Masini
Sviluppo di servizi REST per Android - Luca Masini Sviluppo di servizi REST per Android - Luca Masini
Sviluppo di servizi REST per Android - Luca Masini Whymca
 
SVILUPPO DI SERVIZI REST PER ANDROID
SVILUPPO DI SERVIZI REST PER ANDROIDSVILUPPO DI SERVIZI REST PER ANDROID
SVILUPPO DI SERVIZI REST PER ANDROIDLuca Masini
 
I cataloghi delle biblioteche e il nuovo Web (1)
I cataloghi delle biblioteche e il nuovo Web (1)I cataloghi delle biblioteche e il nuovo Web (1)
I cataloghi delle biblioteche e il nuovo Web (1)Andrea Marchitelli
 
Il mercato SOA: futuro e prospettive
Il mercato SOA: futuro e prospettiveIl mercato SOA: futuro e prospettive
Il mercato SOA: futuro e prospettiveEmanuele Della Valle
 
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...Antonio Musarra
 
DomusDotNet, DotNetCode & dotNET{podcast} Meetup - Serverless Computing - Gio...
DomusDotNet, DotNetCode & dotNET{podcast} Meetup - Serverless Computing - Gio...DomusDotNet, DotNetCode & dotNET{podcast} Meetup - Serverless Computing - Gio...
DomusDotNet, DotNetCode & dotNET{podcast} Meetup - Serverless Computing - Gio...Codemotion
 
ASP.NET AND Azure Function
ASP.NET AND Azure FunctionASP.NET AND Azure Function
ASP.NET AND Azure FunctionLuca Congiu
 
Liferay: Esporre Web Services Custom
Liferay: Esporre Web Services CustomLiferay: Esporre Web Services Custom
Liferay: Esporre Web Services CustomAntonio Musarra
 
Introduzione a Service Fabric e Actor Model
Introduzione a Service Fabric e Actor ModelIntroduzione a Service Fabric e Actor Model
Introduzione a Service Fabric e Actor ModelAndrea Tosato
 
Introduzione agli Hooks – Primo Episodio
Introduzione agli Hooks – Primo EpisodioIntroduzione agli Hooks – Primo Episodio
Introduzione agli Hooks – Primo EpisodioAntonio Musarra
 
Software modularity, microservices ed headless platform all in one. Liferay: ...
Software modularity, microservices ed headless platform all in one. Liferay: ...Software modularity, microservices ed headless platform all in one. Liferay: ...
Software modularity, microservices ed headless platform all in one. Liferay: ...Commit University
 
.NET Microservices
.NET Microservices.NET Microservices
.NET MicroservicesLuca Congiu
 
AngularJs, Bootstrap e Cordova: il connubio per app mobile cross-platform
AngularJs, Bootstrap e Cordova: il connubio per app mobile cross-platformAngularJs, Bootstrap e Cordova: il connubio per app mobile cross-platform
AngularJs, Bootstrap e Cordova: il connubio per app mobile cross-platformGabriele Gaggi
 
Installazione del cms alfresco
Installazione del cms alfrescoInstallazione del cms alfresco
Installazione del cms alfrescoMirco Leo
 
Designing with microservices - Daniele Mondello
Designing with microservices - Daniele MondelloDesigning with microservices - Daniele Mondello
Designing with microservices - Daniele MondelloDaniele Mondello
 

Similar to JAX-WS e JAX-RS (20)

Set up and management of an integrated information system on Linux.
Set up and management of an integrated information system on Linux.Set up and management of an integrated information system on Linux.
Set up and management of an integrated information system on Linux.
 
Set up and management of an integrated information system on Linux.
Set up and management of an integrated information system on Linux.Set up and management of an integrated information system on Linux.
Set up and management of an integrated information system on Linux.
 
Sviluppo di servizi REST per Android - Luca Masini
Sviluppo di servizi REST per Android - Luca Masini Sviluppo di servizi REST per Android - Luca Masini
Sviluppo di servizi REST per Android - Luca Masini
 
SVILUPPO DI SERVIZI REST PER ANDROID
SVILUPPO DI SERVIZI REST PER ANDROIDSVILUPPO DI SERVIZI REST PER ANDROID
SVILUPPO DI SERVIZI REST PER ANDROID
 
Swagger per tutti
Swagger per tuttiSwagger per tutti
Swagger per tutti
 
I cataloghi delle biblioteche e il nuovo Web (1)
I cataloghi delle biblioteche e il nuovo Web (1)I cataloghi delle biblioteche e il nuovo Web (1)
I cataloghi delle biblioteche e il nuovo Web (1)
 
Il mercato SOA: futuro e prospettive
Il mercato SOA: futuro e prospettiveIl mercato SOA: futuro e prospettive
Il mercato SOA: futuro e prospettive
 
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...
Liferay SSL/TLS Security. Come configurare il bundle Liferay per abilitare il...
 
DomusDotNet, DotNetCode & dotNET{podcast} Meetup - Serverless Computing - Gio...
DomusDotNet, DotNetCode & dotNET{podcast} Meetup - Serverless Computing - Gio...DomusDotNet, DotNetCode & dotNET{podcast} Meetup - Serverless Computing - Gio...
DomusDotNet, DotNetCode & dotNET{podcast} Meetup - Serverless Computing - Gio...
 
ASP.NET AND Azure Function
ASP.NET AND Azure FunctionASP.NET AND Azure Function
ASP.NET AND Azure Function
 
Liferay: Esporre Web Services Custom
Liferay: Esporre Web Services CustomLiferay: Esporre Web Services Custom
Liferay: Esporre Web Services Custom
 
Introduzione a Service Fabric e Actor Model
Introduzione a Service Fabric e Actor ModelIntroduzione a Service Fabric e Actor Model
Introduzione a Service Fabric e Actor Model
 
Introduzione agli Hooks – Primo Episodio
Introduzione agli Hooks – Primo EpisodioIntroduzione agli Hooks – Primo Episodio
Introduzione agli Hooks – Primo Episodio
 
Software modularity, microservices ed headless platform all in one. Liferay: ...
Software modularity, microservices ed headless platform all in one. Liferay: ...Software modularity, microservices ed headless platform all in one. Liferay: ...
Software modularity, microservices ed headless platform all in one. Liferay: ...
 
Tesina Grupposis
Tesina GrupposisTesina Grupposis
Tesina Grupposis
 
.NET Microservices
.NET Microservices.NET Microservices
.NET Microservices
 
AngularJs, Bootstrap e Cordova: il connubio per app mobile cross-platform
AngularJs, Bootstrap e Cordova: il connubio per app mobile cross-platformAngularJs, Bootstrap e Cordova: il connubio per app mobile cross-platform
AngularJs, Bootstrap e Cordova: il connubio per app mobile cross-platform
 
Installazione del cms alfresco
Installazione del cms alfrescoInstallazione del cms alfresco
Installazione del cms alfresco
 
Designing with microservices - Daniele Mondello
Designing with microservices - Daniele MondelloDesigning with microservices - Daniele Mondello
Designing with microservices - Daniele Mondello
 
Link. javascript ajax
  Link. javascript ajax  Link. javascript ajax
Link. javascript ajax
 

More from Antonio Musarra

Liferay Portal CE 7.4: Come configurare Oracle Database 19c
Liferay Portal CE 7.4: Come configurare Oracle Database 19cLiferay Portal CE 7.4: Come configurare Oracle Database 19c
Liferay Portal CE 7.4: Come configurare Oracle Database 19cAntonio Musarra
 
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...Antonio Musarra
 
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19c
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19cCome installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19c
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19cAntonio Musarra
 
Liferay & Salesforce.com
Liferay & Salesforce.comLiferay & Salesforce.com
Liferay & Salesforce.comAntonio Musarra
 
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle Database
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle DatabaseCome installare Liferay 7 su JBOSS EAP con il supporto​ Oracle Database
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle DatabaseAntonio Musarra
 
SugarCRM Enterprise Development Virtual Appliance
SugarCRM Enterprise Development Virtual ApplianceSugarCRM Enterprise Development Virtual Appliance
SugarCRM Enterprise Development Virtual ApplianceAntonio Musarra
 
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.Antonio Musarra
 
SugarCRM REST API: Un’applicazione in appena dieci minuti
SugarCRM REST API: Un’applicazione in appena dieci minutiSugarCRM REST API: Un’applicazione in appena dieci minuti
SugarCRM REST API: Un’applicazione in appena dieci minutiAntonio Musarra
 
How to Build a Java client for SugarCRM
How to Build a Java client for SugarCRMHow to Build a Java client for SugarCRM
How to Build a Java client for SugarCRMAntonio Musarra
 
Liferay Web Services - Come importare utenti da un foglio Excel
Liferay Web Services - Come importare utenti da un foglio ExcelLiferay Web Services - Come importare utenti da un foglio Excel
Liferay Web Services - Come importare utenti da un foglio ExcelAntonio Musarra
 
Introduzione a Liferay Message BUS
Introduzione a Liferay Message BUSIntroduzione a Liferay Message BUS
Introduzione a Liferay Message BUSAntonio Musarra
 
Un CRM dentro un CMS v1.0
Un CRM dentro un CMS v1.0Un CRM dentro un CMS v1.0
Un CRM dentro un CMS v1.0Antonio Musarra
 
Running Kettle Job by API v1.2
Running Kettle Job by API v1.2Running Kettle Job by API v1.2
Running Kettle Job by API v1.2Antonio Musarra
 
SugarCRM Web Services: Build a Apache CXF Client
SugarCRM Web Services: Build a Apache CXF ClientSugarCRM Web Services: Build a Apache CXF Client
SugarCRM Web Services: Build a Apache CXF ClientAntonio Musarra
 
Building a Client .NET for SugarCRM
Building a Client .NET for SugarCRMBuilding a Client .NET for SugarCRM
Building a Client .NET for SugarCRMAntonio Musarra
 
Costruire un client .NET per SugarCRM
Costruire un client .NET per SugarCRMCostruire un client .NET per SugarCRM
Costruire un client .NET per SugarCRMAntonio Musarra
 
Come configurare Liferay 6.0 per Oracle
Come configurare Liferay 6.0 per OracleCome configurare Liferay 6.0 per Oracle
Come configurare Liferay 6.0 per OracleAntonio Musarra
 
HOW TO SAML Password Management (Note)
HOW TO SAML Password Management (Note)HOW TO SAML Password Management (Note)
HOW TO SAML Password Management (Note)Antonio Musarra
 
Come configurare Liferay 6.0 per PostgreSQL
Come configurare Liferay 6.0 per PostgreSQLCome configurare Liferay 6.0 per PostgreSQL
Come configurare Liferay 6.0 per PostgreSQLAntonio Musarra
 
J-SugarCRM UserSync TechnicalGuide
J-SugarCRM UserSync TechnicalGuideJ-SugarCRM UserSync TechnicalGuide
J-SugarCRM UserSync TechnicalGuideAntonio Musarra
 

More from Antonio Musarra (20)

Liferay Portal CE 7.4: Come configurare Oracle Database 19c
Liferay Portal CE 7.4: Come configurare Oracle Database 19cLiferay Portal CE 7.4: Come configurare Oracle Database 19c
Liferay Portal CE 7.4: Come configurare Oracle Database 19c
 
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...
Come installare TIBCO Jasper Reports Server 7.5 Community Edition su RedHat J...
 
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19c
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19cCome installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19c
Come installare Liferay 7.2 GA2 su WildFly 16 + Oracle Database 19c
 
Liferay & Salesforce.com
Liferay & Salesforce.comLiferay & Salesforce.com
Liferay & Salesforce.com
 
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle Database
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle DatabaseCome installare Liferay 7 su JBOSS EAP con il supporto​ Oracle Database
Come installare Liferay 7 su JBOSS EAP con il supporto​ Oracle Database
 
SugarCRM Enterprise Development Virtual Appliance
SugarCRM Enterprise Development Virtual ApplianceSugarCRM Enterprise Development Virtual Appliance
SugarCRM Enterprise Development Virtual Appliance
 
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.
SugarCRM: Come realizzare un Custom Scheduler. Un esempio completo.
 
SugarCRM REST API: Un’applicazione in appena dieci minuti
SugarCRM REST API: Un’applicazione in appena dieci minutiSugarCRM REST API: Un’applicazione in appena dieci minuti
SugarCRM REST API: Un’applicazione in appena dieci minuti
 
How to Build a Java client for SugarCRM
How to Build a Java client for SugarCRMHow to Build a Java client for SugarCRM
How to Build a Java client for SugarCRM
 
Liferay Web Services - Come importare utenti da un foglio Excel
Liferay Web Services - Come importare utenti da un foglio ExcelLiferay Web Services - Come importare utenti da un foglio Excel
Liferay Web Services - Come importare utenti da un foglio Excel
 
Introduzione a Liferay Message BUS
Introduzione a Liferay Message BUSIntroduzione a Liferay Message BUS
Introduzione a Liferay Message BUS
 
Un CRM dentro un CMS v1.0
Un CRM dentro un CMS v1.0Un CRM dentro un CMS v1.0
Un CRM dentro un CMS v1.0
 
Running Kettle Job by API v1.2
Running Kettle Job by API v1.2Running Kettle Job by API v1.2
Running Kettle Job by API v1.2
 
SugarCRM Web Services: Build a Apache CXF Client
SugarCRM Web Services: Build a Apache CXF ClientSugarCRM Web Services: Build a Apache CXF Client
SugarCRM Web Services: Build a Apache CXF Client
 
Building a Client .NET for SugarCRM
Building a Client .NET for SugarCRMBuilding a Client .NET for SugarCRM
Building a Client .NET for SugarCRM
 
Costruire un client .NET per SugarCRM
Costruire un client .NET per SugarCRMCostruire un client .NET per SugarCRM
Costruire un client .NET per SugarCRM
 
Come configurare Liferay 6.0 per Oracle
Come configurare Liferay 6.0 per OracleCome configurare Liferay 6.0 per Oracle
Come configurare Liferay 6.0 per Oracle
 
HOW TO SAML Password Management (Note)
HOW TO SAML Password Management (Note)HOW TO SAML Password Management (Note)
HOW TO SAML Password Management (Note)
 
Come configurare Liferay 6.0 per PostgreSQL
Come configurare Liferay 6.0 per PostgreSQLCome configurare Liferay 6.0 per PostgreSQL
Come configurare Liferay 6.0 per PostgreSQL
 
J-SugarCRM UserSync TechnicalGuide
J-SugarCRM UserSync TechnicalGuideJ-SugarCRM UserSync TechnicalGuide
J-SugarCRM UserSync TechnicalGuide
 

JAX-WS e JAX-RS

  • 1. JAX-WS e JAX-RS Come sviluppare servizi SOAP e REST in standard JAX-WS e JAX-RS su Liferay Antonio Musarra, Software e Architectural Consultant, Key-Biz Srl
  • 2. @antonio_musarra Antonio Musarra (@antonio_musarra) Software e Architectural Consultant, Key-Biz Srl Web: http://www.key-biz.it Blog: http://www.dontesta.it/blog GitHub: https://github.com/amusarra SlideShare: http://www.slideshare.net/amusarra Ho iniziato il mio viaggio nel mondo dell'informatica da un Olivetti M24 dotato di un processore Intel 8086 acquistato da mio padre esclusivamente per il suo lavoro. Non ho mai posseduto console di nessun genere (Commodore, Amiga, etc…) e inizialmente quell'enorme scatola mi terrorizzava, terrore durato poco; giorno dopo giorno prendevo rapidamente il controllo fino a quando…. Ho sempre creduto che la condivisione della conoscenza sia un ottimo mezzo per la crescita personale e questo è stato uno dei principali motivi che mi ha spinto sei anni fa a creare il mio blog personale www.dontesta.it Dicono di me che sono bravo nell'analizzare e risolvere rapidamente i problemi complessi. La mia attività odierna è quella di consulente in progetti enterprise che utilizzano tecnologie Web Oriented come J2EE, Web Services, ESB, TIBCO.
  • 3. Java standard per Web Service JAX-WS (Java API for XML Web Services): è un insieme di API Java dedicate allo sviluppo di servizi web. L'insieme fa parte della piattaforma Java EE. JAX-WS usa annotazioni per semplificare lo sviluppo e le implementazioni di client. JAX-WS include Java Architecture for XML Binding (JAXB) e SOAP. @antonio_musarra JAX-RS (Java API for RESTful): è un insieme di API Java dedicate allo sviluppo di servizi web in base al pattern architetturale Representational State Transfer (REST). L'insieme fa parte della piattaforma Java EE. JAX-RS usa annotazioni per semplificare lo sviluppo e le implementazioni di client.
  • 4. Liferay Web Service • La generazione e l’invocazione dei servizi web è una parte centrale della esperienza di sviluppo Liferay • Liferay senza servizi web sarebbe come una macchina di lusso senza ruote. • Fortunatamente, Liferay è dotato di una serie completa di servizi JSON e SOAP che espongo tutte le funzionalità core. • Liferay offre anche il framework (Service Builder) per generare servizi locali e remoti per le tue applicazioni. @antonio_musarra
  • 5. Standard JAX-WS e JAX-RS @antonio_musarra • Dalla versione 7 Liferay supporta i due standard java per i servizi web JAX-WS e JAX-RS • L’implementazione dei due standard JAX-WS e JAX-RS che Liferay ha deciso di adottare è Apache CXF • Ogni Apps può pubblicare i servizi web su endpoint Apache CXF definiti sulla propria istanza Liferay • Gli endpoint Apache CXF sono effettivamente percorsi di contesto (o context path) dei servizi web dove vengono distribuiti e resi accessibili • E’ possibile definire sulla propria istanza Liferay uno o più endpoint Apache CXF • Per accedere ai servizi web, un extender deve essere configurato nell'istanza Liferay
  • 6. Liferay SOAP e REST Extender @antonio_musarra Gli Extenders specificano dove i servizi vengono distribuiti e se hanno handler, filter, provider, etc. Ci sono due tipi di extender: • SOAP Extenders: Richiesto per la pubblicazione di servizi web JAX-WS in grado di distribuire su uno o più endpoint CXF con la possibilità di configurare handler, filter, provider, etc. • REST Extenders: Richiesto per la pubblicazione di servizi web JAX-RS e offre servizi analoghi all’extender SOAP. JAX WS API JSR-224 JAX RS API JSR-370 Apache CXF (v. 3.0.3) Liferay SOAP Extender Liferay REST Extender My Liferay 7 App Rest Service SOAP Service
  • 7. Liferay SOAP e REST Extender @antonio_musarra • I SOAP e REST Extender sono dei sottosistemi che tracciano i servizi corrispondenti ai filtri OSGi specificati in configurazione e li distribuiscono sotto a specifici endpoint CXF • Tramite i filtri OSGi posso istruire gli extender per registrare non solo i servizi web REST e SOAP ma anche per indicare quali sono i componenti che implementano gli eventuali handler, filter e provider • Gli endpoint CXF per entrambi i tipi di extender possono essere creati a livello di codice o tramite il Pannello di controllo di Liferay
  • 8. Liferay SOAP e REST Extender @antonio_musarra Per ogni extenders abbiamo la possibilità di configurare ogni elemento tramite Pannello di controllo Liferay o per via programmatica attraverso l’indicazione sul file bnd di quale sia il file di configurazione da adottare per il bundle che contiene i servizi web.
  • 9. Pubblicazione dei servizi JAX-RS @antonio_musarra È possibile pubblicare un servizio web JAX-RS che risiede all’interno di un modulo Liferay così come si farebbe al di fuori di Liferay. A seguire l’esempio di un servizio.
  • 10. Pubblicazione dei servizi JAX-WS @antonio_musarra È possibile pubblicare un servizio web JAX-WS che risiede all’interno di un modulo Liferay così come si farebbe al di fuori di Liferay. A seguire l’esempio di un servizio
  • 11. Costruiamo un progetto d’esempio @antonio_musarra Supponiamo che un sistema esterno abbia bisogno di accedere ad un set di dati che risiedono su Liferay attraverso un set di API semplici esposte via JAX-RS e JAX-WS. Come procedere? • Definire l’insieme d’interfacce, quindi il set di API • Implementare l’insieme d’interfacce come servizi locali • Implementare l’endpoint JAX-RS per i servizi web REST • Implementare l’endpoint JAX-WS per i servizi web SOAP • Configurare gli Extender SOAP e REST sull’instanza di Liferay
  • 12. Costruiamo un progetto d’esempio @antonio_musarra Il progetto Liferay è organizzato in moduli distribuiti così come indicato nella mappa e ogni modulo è poi i realtà un bundle OSGi che andrà installato sull’istanza Liferay. La nostra istanza Liferay conterrà quindi quattro bundle OSGi.
  • 13. Costruiamo un progetto d’esempio @antonio_musarra I due bundle rappresentano i due endpoint JAX-RS e JAX-WS che implementano le API definite dal modulo Custom User Service API. In figura sono evidenti gli endpoint CXF e i filtri OSGi che consento agli extender la registrazione come servizi.
  • 14. Costruiamo un progetto d’esempio @antonio_musarra Nel class diagram sono indicate le interfacce e le implementazioni dei servizi locali e remoti esposti come endpoint JAX-WS e JAX-RS
  • 15. Deploy e test dei servizi @antonio_musarra Dopo il deploy del progetto abbiamo attivi i quattro bundle OSGi, così come visibile nella figura a seguire (esecuzione del comando lb | grep Custom). Da questo momento i servizi web sono disponibili. Gli endpoint dei servizi web (sulla propria istanza Liferay) sono: • http://localhost:8080/o/rest/ext.persons • http://localhost:8080/o/web-services/CustomUserServiceWSEndPoint
  • 16. Deploy e test dei servizi @antonio_musarra In figura l’esempio un esempio di chiamata al servizio web JAX-RS appena installato. La chiamata è stata eseguita tramite il comando curl. curl -v http://localhost:8080/o/rest/ext.persons /list/tag/it-architect | prettyjson In questo caso il servizio restituisce i contatti Liferay che sono taggati con il valore it-architect.
  • 17. Ci vediamo al prossimo Symposium @antonio_musarra …Però, se siete curiosi di scoprire di più su Liferay 7: • http://www.dontesta.it/blog • http://www.slideshare.net/amusarra • https://github.com/amusarra • https://dev.liferay.com …e nel frattempo scaricate l’intero progetto da https://github.com/amusarra/liferay-web- services-jaxwsrs Antonio Musarra @antonio_musarra Grazie!