Java/J2ee Programming Training
Java Web Services
Page 2Classification: Restricted
Agenda
• Intoduction to WebServices
• Interoperability
• XML
• UDDI – Universal discovery description and Integration
• Conversion—java to soap message
• Writing a web service
• Contract vs service
• WSDL generation
Page 3Classification: Restricted
WEB SERVICES
SOAP
JAX-JS
REST
JAS-RS
Introduction to Web Services
Page 4Classification: Restricted
Web Services
• available over internet
• consumed by application
Page 5Classification: Restricted
Interoperability
JAVA WEB
SERVICE
.NET WEB
SERVICE
C++
Page 6Classification: Restricted
Web Services
getProducts()
MVC
getProducts.jar
Page 7Classification: Restricted
Terms
webservice Implinterfaceconsumer
webservice Implinterfaceconsumer
Page 8Classification: Restricted
XML
• WSdl-web service definition language
• contract definition of webservice
• shared with consumers
---java interface in xml format.
Page 9Classification: Restricted
UDDI – Universal discovery description and Integration
• locates web service.
• can query the directory to fetch the service.
CLIENTS UDDI
service
Page 10Classification: Restricted
SOAP: simple access object protocol
JAVA WSDL WEBSERVICE
JAVA
XML
======
SOAP
WEBSERVICE
SOAP: simple access object protocol
Page 11Classification: Restricted
Conversion—Java to SOAP message
• service end point( SEI)—acts as an interface to service end point
• converts java code to soap message
SEI
WEB SERVICE
SOAP
=====
XML
Page 12Classification: Restricted
Writing a web service
@Webservice
class BookTickets
{
public List<String> getShowNames()
{
List<String> shows = new ArrayList<>();
shows.add( “abcd”);
shows.add(“ppp”);
show.add(“qqq”);
}
}
Page 13Classification: Restricted
Contract vs Service
• Contract ---interface
• service – business logic
• most of the time we write the interface
Page 14Classification: Restricted
WSDL Generation
WSDL
WEB_SE
RVICE
Page 15Classification: Restricted
<service name="BookTicketsService">
<port name="BookTicketsPort" binding="tns:BookTicketsPortBinding">
<soap:address location="http://aatika-pc:31820/WebServiceEx/BookTicketsService"/>
</port></service>
WSDL
Page 17Classification: Restricted
Page 18Classification: Restricted
Thank You

Java Webservices