SlideShare a Scribd company logo
JAX-WS - Java API for XML Web Services indigoo.com
JAX-WS
JAVA API FOR XML WEB SERVICES
INTRODUCTION TO JAX-WS, THE JAVA API FOR XML
BASED WEB SERVICES (SOAP, WSDL)
JAX-WS - Java API for XML Web Services
Contents
1. What is JAX-WS?
2. Glassfish = Reference implementation for JAX-WS
3. Glassfish projects, Java packages
4. POJO / Java bean as web service class
5. JAX-WS JavaBeans versus provider endpoint
6. JAX-WS dispatch client versus dynamic client proxy API
7. JAX-WS development / deployment
8. JAXB – Binding XML documents to Java objects
9. JAXR – JAVA API for XML Registries
10. WSIT – Web Service Interoperability Technologies
11. Short comparison of important Java WS stacks
JAX-WS - Java API for XML Web Services
1. What is JAX-WS?
JAX-WS is the core Java web service technology (standard for Java EE):
 JAX-WS is the standard programming model / API for WS on Java (JAX-WS became a
standard part of Java as of version 1.6).
 JAX-WS is platform independent (many Java platforms like Glassfish, Axis2 or CXF
support JAX-WS). Services developed on one platform can be easily ported to another
platform.
 JAX-WS makes use of annotations like @WebService. This provides better scalability (no
central deployment descriptor for different WS classes is required).
 JAX-WS uses the POJO concept (use of plain Java classes to define web service
interfaces).
 JAX-WS replaces / supersedes JAX-RPC (= old Java web services, basically RMI over
web service). JAX-WS is more document orientiented instead of RPC-oriented.
Glassfish is the JAX-WS reference implementation (RI, see https://jax-ws.java.net/).
JAX-WS - Java API for XML Web Services
Glassfish JEE app. server RI
2. Glassfish = Reference implementation for JAX-WS
Glassfish:
Metro:
JAXB:
SAAJ:
JAX-WS:
WSIT:
JAXR:
StaX:
Java EE reference implementation (RI), reference Java application server.
WS stack as part of Glassfish (consists of JAX-WS and WSIT components).
Data binding (bind objects to XML documents or fragments).
SOAP withAttachments API for Java.
Java core web service stack.
Web Services Interoperability Technologies (enables interop with .Net).
Java API for XML Registries (WS registry).
Streaming API for XML.
Details see https://glassfish.java.net/downloads/3.1.1-final.html
Metro stack
JAXB
JSR-222
JAX-WS (core WS)
JSR-224
Security
JAXP
StaX
JSR-173
RM
Trans-
actions
SAAJ
HTTP TCP JMS SMTP
WSIT
JAX-WS
Transports
XML
Meta-
data
WSDL
Policy
Jersey
(JAX-RS)
CORBA
EJB1)
1) Local container only
Grizzly /
COMET
JAXR
OpenMQ
JAX-WS - Java API for XML Web Services
3. Glassfish projects, Java packages (selection)
Glassfish is developed in various independent projects. Together, they build the Glassfish
service platform.
Parent project Project Description Java package
Glassfish GF-CORBA CORBA com.sun.corba.se.*
Glassfish OpenMQ JMS javax.jms.*
Glassfish WADL IDL for REST services org.vnet.ws.wadl.*
org.vnet.ws.wadl2java.*
Glassfish JAX-RS, Jersey (=RI) REST services javax.ws.rs.*
jax-ws-xml, jwsdp JAXB Java API for XML Binding javax.xml.bind.*
jax-ws-xml, jwsdp JAX-RPC Java API for XML RPC
Old Java WS (superseded by JAX-WS)
java.xml.rpc.*
Metro (Glassfish) JAX-WS Java API for XML Web Services javax.jws.*
javax.xml.ws.*
Metro (Glassfish) SAAJ SOAP attachments javax.xml.soap.*
Metro (Glassfish) WSIT (previously
Tango)
Web Services Interoperability Technologies
(WS-Trust etc.)
Various
JAX-WS - Java API for XML Web Services
Called by container before the implementing class is called the
first time.
Called by container before the implementing class goes out of
operation.
4. POJO / Java bean as web service class (1/2)
Web services through simple annotations:
The programming model of JAX-WS relies on simple annotations.
This allows to turn existing business classes (POJOs) into web services with very little effort.
Web service endpoints are either explicit or implicit, depending on the definition or absence of
a Java interface that defines the web service interface.
Implicit SEI (Service Endpoint Interface):
Service does not have an explicit service interface, i.e. the class itself is the service interface.
@WebService
public class HelloWorld
{
@WebMethod
public String sayHello() {...}
public HelloWorld() {...}
@PostConstruct
public void init() {...}
@PreDestroy
public void teardown() {...}
}
Through @WebService annotation, the class HelloWorld becomes
an SEI (Service Endpoint Interface) and all public methods
are exposed.
Annotation for individual method to be exposed
as a web service method.
The SEI implementing class must have a public default ctor.
JAX-WS - Java API for XML Web Services
Explicit endpoint interface.
Reference to explicit service endpoint interface.
4. POJO / Java bean as web service class (2/2)
Explicit SEI:
The service bean has an associated service endpoint interface (reference to interface).
public interface IHello
{
@WebMethod
public String sayHello() {...}
}
@WebService(endpointInterface=IHello)
public class HelloWorld
{
public String sayHello() {...}
}
JAX-WS - Java API for XML Web Services
5. JAX-WS JavaBeans versus provider endpoint (1/3)
Web services on the service provider side can be defined at 2 levels:
 The annotation @WebService is a high-level annotation to turn a POJO into a web service.
 The @WebServiceProvider is lower-level and gives more control over the web service.
RPC call
(API)
SOAP
engine
HTTP
engine
Application
Service consumer
Procedure
(marshaling)
SOAP
engine
HTTP
engine
Application
@WebService
Service provider
Application
@WebServiceProvider
JAX-WS - Java API for XML Web Services
5. JAX-WS JavaBeans versus provider endpoint (2/3)
A. JavaBeans endpoints (@WebService annotation):
JavaBeans as endpoints allow to expose Java classes (actually methods) as web services.
This hides most of the WS complexity to the programmer.
JavaBeans endpoint example:
@WebService
public class HelloWorld
{
@WebMethod
public String sayHello() {...}
}
JAX-WS - Java API for XML Web Services
© Peter R. Egli 2015
5. JAX-WS JavaBeans versus provider endpoint (3/3)
B. Provider endpoints (@WebServiceProvider annotation):
Provider endpoints are more generic, message-based service implementations. The service
operates directly on (SOAP) message level. The service implementation defines 1 generic
method "invoke" that accepts a SOAP message and returns a SOAP result. The provider
interface allows to operate a web service in payload mode (service method directly receives
XML messages).
Provider endpoint example:
The web service class has only a single method invoke. This method receives the SOAP
messages. Decoding of the message takes place in this method.
@WebServiceProvider(
portName="HelloPort",
serviceName="HelloService",
targetNamespace="http://helloservice.org/wsdl"
, wsdlLocation="WEB-
INF/wsdl/HelloService.wsdl"
)
@BindingType(value="http://schemas.xmlsoap.org/wsdl/soap/http")
@ServiceMode(value=javax.xml.ws.Service.Mode.MESSAGE)
public class HelloProvider implements Provider<SOAPMessage> {
private static final String helloResponse =
... public SOAPMessage invoke(SOAPMessage req)
{
...
}
}
JAX-WS - Java API for XML Web Services
6. JAX-WS dispatch client versus dynamic client proxy API (1/3)
Similar to the server APIs, JAX-WS clients may use 2 different APIs for sending web service
requests.
 A dispatch client gives direct access to XML / SOAP messages.
 A dynamic proxy client provides an RPC-like interface to the client application.
RPC call
(API)
SOAP
engine
HTTP
engine
Application
Service consumer
Procedure
(marshaling)
SOAP
engine
HTTP
engine
Application
Service provider
Dispatch
client API
Dynamic
proxy client
API
JAX-WS - Java API for XML Web Services
6. JAX-WS dispatch client versus dynamic client proxy API (2/3)
A. Dispatch client (dynamic client programming model):
The dispatch client has direct access to XML (SOAP) messages. The dispatch client is
responsible for creating SOAP messages. It is called dynamic because it constructs SOAP
messages at runtime.
Dispatch client example (source: axis.apache.org):
String endpointUrl = ...;
QName serviceName = new QName("http://org/apache/ws/axis2/sample/echo/", "EchoService");
QName portName = new QName("http://org/apache/ws/axis2/sample/echo/", "EchoServicePort");
/** Create a service and add at least one port to it. **/
Service service = Service.create(serviceName);
service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl);
/** Create a Dispatch instance from a service.**/
Dispatch<SOAPMessage> dispatch = service.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
/** Create SOAPMessage request message. **/
MessageFactory mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
// Create a message. This example works with the SOAPPART.
SOAPMessage request = mf.createMessage();
SOAPPart part = request.getSOAPPart();
// Obtain the SOAPEnvelope and header and body elements.
SOAPEnvelope env = part.getEnvelope();
SOAPHeader header = env.getHeader();
SOAPBody body = env.getBody();
// Construct the message payload.
SOAPElement operation = body.addChildElement("invoke", "ns1", "http://org/apache/ws/axis2/sample/echo/");
SOAPElement value = operation.addChildElement("arg0");
value.addTextNode("ping");
request.saveChanges();
/** Invoke the service endpoint. **/ SOAPMessage
response = dispatch.invoke(request);
JAX-WS - Java API for XML Web Services
6. JAX-WS dispatch client versus dynamic client proxy API (3/3)
B. Dynamic proxy client (static client programming model):
A dynamic proxy client is similar to a stub client in the JAX-RPC programming model (=RPC
model). A dynamic proxy client uses a service endpoint interface (SEI) which must be provided.
The dynamic proxy client classes are generated at runtime (by the Java dynamic proxy
functionality).
Dynamic proxy client example:
EchoService port = new EchoService().getEchoServicePort();
String echo = port.echo("Hello World");
JAX-WS - Java API for XML Web Services
principle).
wsgen.exe
*.java CodeCJoAdXeB
classes
Annotated Service Endpoint Interface /
Implementation (POJO).
Public methods are web (exposed) methods or
use @WebMethod annotation.
SEI (Service Endpoint Interface) =
Java class with methods that can be called by client.
javac.exe
*.class
Portable JAXB classes for
marshalling /
unmarshalling
messages
WSDL
file Service description
as WSDL file
7. JAX-WS development / deployment (1/2)
1. Start with POJO / bean class as service class (bottom-up development):
Server stub files and (optionally) WSDL files are created from Java class file(s).
The deployment descriptor web.xml is optional (JAX-WS defaults are
sufficient for many / most applications, "configuration by exception"
web.xml
(deployment
descriptor,
optional)
Platform
specific
packaging
and
deployment
WAR,
AAR etc.
JAX-WS - Java API for XML Web Services
7. JAX-WS development / deployment (2/2)
2. Start with WSDL file (top-down development):
Server stub files are created from an existing WSDL file.
3. Creation of client stub files from a WSDL file
(dynamic proxy client):
wsimport.exe
CSoedrever
Csotdueb
classes
WSDL
file
Portable artefacts for client & server:
• Service class
• SEI class
• Exception class
• JAXB classes for marshalling messages
Platform
specific
packaging
and
deployment
web.xml
(deployment
descriptor,
optional)
WAR,
AAR etc.
wsimport.exe
WSDL
file
Cocldieent
Csotdueb
files
JAX-WS - Java API for XML Web Services
8. JAXB – Binding XML documents to Java objects
JAX-WS uses JAXB for the binding between Java objects and XML documents.
The binding / JAXB details are hidden from the JAX-WS programmer.
Schema
JJAAXXBB
mmaappppeedd
cclalasssseess
JAXB
mapped
classes
OObbjejecctsts
Objects
Document
(XML)
bind
unmarshal
(validate)
marshal
(validate)
follows instances of
JAXB mapping of XML
schema built-in types to
Java built-in types (selection):
Relationship between
schema, document, Java
objects and classes with
JAXB:
XML schema type Java data type
xsd:string java.lang.String
xsd:integer java.math.BigInteger
xsd:int int
xsd:long long
xsd:short short
JAX-WS - Java API for XML Web Services
9. JAXR – JAVAAPI for XML Registries
JAXR is a uniform and standard API for accessing different kinds of XML registries.
XML registries are used for registering (by server / service) and discovering (by client) web
services.
JAXR follows the well-known pattern in Java with a service provider interface (SPI for
registering XML metadata) and a client interface (see also JMS or JNDI).
Source: docs.oracle.com
JAXR Client
ebXML
JAXR API
Capability-Specific Interfaces
UDDI
Provider Provider
Other
Provider
ebXML UDDI Other
Registry-specific
JAXR provider
ebXML /
SOAP
UDDI /
SOAP
Other
Registries
JAX-WS - Java API for XML Web Services
10. WSIT – Web Service Interoperability Technologies (1/2)
Interoperability is crucial for web services (web services in general claim platform
independence and interoperability).
WSIT is the standard Java WS protocol stack beyond basic WS functionality (SOAP, WSDL) to
achieve interoperability between Java and .Net (for more complex applications that go beyond
simple WS requests).
JAX-WS defines the WS core stack while WSIT provides many of the WS-* standards required
for interoperability.
WSIT is an open source project started by Sun Microsystems to promote
WS-interoperability with .Net 3.0 (WCF).
WSIT is bundled inside the Metro WS stack. The Metro stack in turn is bundled inside Glassfish
(see Slide 2).
WS-I (Web Service Interoperability) defines profiles (sets of WS standards, see
www.oasis-ws-i.org/) for which WS stacks can claim compatibility such as:
WS-I Basic Profile 1.1:
WS-I Basic Profile 1.2:
WS-I Simple SOAP Binding Profile 1.0:
SOAP 1.1 + HTTP 1.1 + WSDL 1.1
SOAP 1.1 + HTTP 1.1 + WSDL 1.1 + WS-Addressing 1.0 + MTOM 1.0
SOAP 1.1 + HTTP 1.1 + WSDL 1.1 + UDDI
WSIT versus WS-I?
WS-I defines profiles while WSIT implements them.
JAX-WS - Java API for XML Web Services
10. WSIT – Web Service Interoperability Technologies (2/2)
Overview of WS-standards compliance by JAX-WS / Metro-stack and WCF:
Standard JAX-WS
(Metro@Glassfish)
Microsoft
WCF
Description
WS-I Basic Profile Yes (JAX-WS) Yes SOAP 1.1 + HTTP 1.1 + WSDL 1.1.
WS-MetadataExchange Yes (WSIT) Yes Exchange of web service meta-data files.
WS-Transfer Yes (WSIT) Yes Protocol for accessing XML-representations of WS resources.
WS-Policy Yes (WSIT) Yes XML-representations of WS policies (security, QoS).
WS-Security Yes (WSIT) Yes Framework protocol for applying security to web services.
WS-SecureConversation Yes (WSIT) Yes Protocol for sharing security contexts between sites.
WS-Trust Yes (WSIT) Yes Protocol for establishing trust between WS provider and consumer.
WS-SecurityPolicy Yes (WSIT) Yes Set of security policy assertions to be used with WS-Policy.
WS-ReliableMessaging Yes (WSIT) Yes Protocol for reliable WS message delivery (in-order, exactly-once).
WS-RMPolicy Yes (WSIT) Yes XML-representations of WS policies of RM-WS-endpoints.
WS-Coordination Yes (WSIT) Yes Protocol for coordinating web service participants (providers, consumers).
WS-AtomicTransaction Yes (WSIT) Yes Protocol for atomic transactions with groups of web services.
WS-BusinessActivity No Yes (.Net 4.0) Business activity coordination to be used in the WS-Coordination framework.
WS-Eventing No No Protocol for subscribe / publish to WS for receiving notifications.
WS-Notification No No Protocol for subscribe / publish to topic-based WS for receiving notifications.
JAX-WS - Java API for XML Web Services
11. Short comparison of important Java WS stacks
1. JAX-WS (Glassfish RI):
 JAX-WS compliant (the reference implementation defines the standard).
 Supported by many WS frameworks.
2. Apache CXF framework:
 Easy to use, slim.
3. Apache Axis2:
 Features-rich, but also high complexity.
 Not (fully) JAX-WS compliant (not JAX-WS technology compatibility kit compliant).
 Support for different XML-Java binding frameworks (XMLBeans etc.).
4. JBoss:
 Actually uses Glassfish / Metro as WS-stack (http://jbossws.jboss.org/).
5. Spring WS:
 Contract-first development (first WSDL, then code).
 Support for different XML-Java binding frameworks (XMLBeans, JiXB etc.).
Comparison of Java WS stacks se also http://wiki.apache.org/ws/StackComparison.

More Related Content

What's hot

Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WS
IndicThreads
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RS
Fahad Golra
 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
Nicola Pedot
 
Introduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web ServicesIntroduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web Services
ecosio GmbH
 
Java Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web ServicesJava Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web Services
IMC Institute
 
Web development with ASP.NET Web API
Web development with ASP.NET Web APIWeb development with ASP.NET Web API
Web development with ASP.NET Web API
Damir Dobric
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
Dzmitry Naskou
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
Abhi Arya
 
MuleSoft Consuming Soap Web Service - CXF jax-ws-client Module
MuleSoft Consuming Soap Web Service - CXF jax-ws-client ModuleMuleSoft Consuming Soap Web Service - CXF jax-ws-client Module
MuleSoft Consuming Soap Web Service - CXF jax-ws-client Module
Vince Soliza
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
Adnan Masood
 
Websphere interview Questions
Websphere interview QuestionsWebsphere interview Questions
Websphere interview Questions
gummadi1
 
Enjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIEnjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web API
Kevin Hazzard
 
Stateful SOAP Webservices
Stateful SOAP WebservicesStateful SOAP Webservices
Stateful SOAP WebservicesMayflower GmbH
 
java servlet and servlet programming
java servlet and servlet programmingjava servlet and servlet programming
java servlet and servlet programming
Kumar
 
Ibm web sphere application server interview questions
Ibm web sphere application server interview questionsIbm web sphere application server interview questions
Ibm web sphere application server interview questions
praveen_guda
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
Ankit Minocha
 
Web Services Presentation - Introduction, Vulnerabilities, & Countermeasures
Web Services Presentation - Introduction, Vulnerabilities, & CountermeasuresWeb Services Presentation - Introduction, Vulnerabilities, & Countermeasures
Web Services Presentation - Introduction, Vulnerabilities, & Countermeasures
Praetorian
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
BG Java EE Course
 
The Full Power of ASP.NET Web API
The Full Power of ASP.NET Web APIThe Full Power of ASP.NET Web API
The Full Power of ASP.NET Web API
Eyal Vardi
 

What's hot (20)

Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WS
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RS
 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
 
Introduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web ServicesIntroduction to SOAP/WSDL Web Services and RESTful Web Services
Introduction to SOAP/WSDL Web Services and RESTful Web Services
 
Java Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web ServicesJava Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web Services
 
Web development with ASP.NET Web API
Web development with ASP.NET Web APIWeb development with ASP.NET Web API
Web development with ASP.NET Web API
 
Spring Framework - MVC
Spring Framework - MVCSpring Framework - MVC
Spring Framework - MVC
 
Web service introduction
Web service introductionWeb service introduction
Web service introduction
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
 
MuleSoft Consuming Soap Web Service - CXF jax-ws-client Module
MuleSoft Consuming Soap Web Service - CXF jax-ws-client ModuleMuleSoft Consuming Soap Web Service - CXF jax-ws-client Module
MuleSoft Consuming Soap Web Service - CXF jax-ws-client Module
 
Web API or WCF - An Architectural Comparison
Web API or WCF - An Architectural ComparisonWeb API or WCF - An Architectural Comparison
Web API or WCF - An Architectural Comparison
 
Websphere interview Questions
Websphere interview QuestionsWebsphere interview Questions
Websphere interview Questions
 
Enjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web APIEnjoying the Move from WCF to the Web API
Enjoying the Move from WCF to the Web API
 
Stateful SOAP Webservices
Stateful SOAP WebservicesStateful SOAP Webservices
Stateful SOAP Webservices
 
java servlet and servlet programming
java servlet and servlet programmingjava servlet and servlet programming
java servlet and servlet programming
 
Ibm web sphere application server interview questions
Ibm web sphere application server interview questionsIbm web sphere application server interview questions
Ibm web sphere application server interview questions
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
Web Services Presentation - Introduction, Vulnerabilities, & Countermeasures
Web Services Presentation - Introduction, Vulnerabilities, & CountermeasuresWeb Services Presentation - Introduction, Vulnerabilities, & Countermeasures
Web Services Presentation - Introduction, Vulnerabilities, & Countermeasures
 
Java Server Faces (JSF) - Basics
Java Server Faces (JSF) - BasicsJava Server Faces (JSF) - Basics
Java Server Faces (JSF) - Basics
 
The Full Power of ASP.NET Web API
The Full Power of ASP.NET Web APIThe Full Power of ASP.NET Web API
The Full Power of ASP.NET Web API
 

Similar to Jax ws

Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
Mule soft ppt 2
Mule soft ppt  2Mule soft ppt  2
Mule soft ppt 2
Vinoth Moorthy
 
Web service- Guest Lecture at National Wokshop
Web service- Guest Lecture at National WokshopWeb service- Guest Lecture at National Wokshop
Web service- Guest Lecture at National WokshopNishikant Taksande
 
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
SachinSingh217687
 
Web services in java
Web services in javaWeb services in java
Web services in java
maabujji
 
Reusing Existing Java EE Applications from SOA Suite 11g
Reusing Existing Java EE Applications from SOA Suite 11gReusing Existing Java EE Applications from SOA Suite 11g
Reusing Existing Java EE Applications from SOA Suite 11g
Guido Schmutz
 
Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0
Saltmarch Media
 
Web services101
Web services101Web services101
Web services101
chaos41
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
slire
 
Html servlet example
Html   servlet exampleHtml   servlet example
Html servlet examplervpprash
 
Web service through cxf
Web service through cxfWeb service through cxf
Web service through cxfRoger Xia
 
Developing SOAP Web Services using Java
Developing SOAP Web Services using JavaDeveloping SOAP Web Services using Java
Developing SOAP Web Services using Java
krishnaviswambharan
 
Java servlets
Java servletsJava servlets
Java servlets
yuvarani p
 
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
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
Mindfire Solutions
 
Apachecon 2009
Apachecon 2009Apachecon 2009
Apachecon 2009
deepalk
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache Tomcat
Auwal Amshi
 
Servlet in java , java servlet , servlet servlet and CGI, API
Servlet in java , java servlet , servlet servlet and CGI, APIServlet in java , java servlet , servlet servlet and CGI, API
Servlet in java , java servlet , servlet servlet and CGI, API
PRIYADARSINISK
 

Similar to Jax ws (20)

Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
Mule soft ppt 2
Mule soft ppt  2Mule soft ppt  2
Mule soft ppt 2
 
Web service- Guest Lecture at National Wokshop
Web service- Guest Lecture at National WokshopWeb service- Guest Lecture at National Wokshop
Web service- Guest Lecture at National Wokshop
 
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected BusinessWSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
WSO2Con Asia 2014 - WSO2 AppDev Platform for the Connected Business
 
WSO2 AppDev platform
WSO2 AppDev platformWSO2 AppDev platform
WSO2 AppDev platform
 
AJppt.pptx
AJppt.pptxAJppt.pptx
AJppt.pptx
 
Web services in java
Web services in javaWeb services in java
Web services in java
 
Reusing Existing Java EE Applications from SOA Suite 11g
Reusing Existing Java EE Applications from SOA Suite 11gReusing Existing Java EE Applications from SOA Suite 11g
Reusing Existing Java EE Applications from SOA Suite 11g
 
Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0
 
Web services101
Web services101Web services101
Web services101
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
 
Html servlet example
Html   servlet exampleHtml   servlet example
Html servlet example
 
Web service through cxf
Web service through cxfWeb service through cxf
Web service through cxf
 
Developing SOAP Web Services using Java
Developing SOAP Web Services using JavaDeveloping SOAP Web Services using Java
Developing SOAP Web Services using Java
 
Java servlets
Java servletsJava servlets
Java servlets
 
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
 
Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)Webservices in SalesForce (part 1)
Webservices in SalesForce (part 1)
 
Apachecon 2009
Apachecon 2009Apachecon 2009
Apachecon 2009
 
Web container and Apache Tomcat
Web container and Apache TomcatWeb container and Apache Tomcat
Web container and Apache Tomcat
 
Servlet in java , java servlet , servlet servlet and CGI, API
Servlet in java , java servlet , servlet servlet and CGI, APIServlet in java , java servlet , servlet servlet and CGI, API
Servlet in java , java servlet , servlet servlet and CGI, API
 

More from F K

WebServices introduction in Mule
WebServices introduction in MuleWebServices introduction in Mule
WebServices introduction in Mule
F K
 
Testing soapui
Testing soapuiTesting soapui
Testing soapui
F K
 
Java For Begineers
Java For BegineersJava For Begineers
Java For Begineers
F K
 
Vm component
Vm componentVm component
Vm component
F K
 
Until successful component in mule
Until successful component in muleUntil successful component in mule
Until successful component in mule
F K
 
Quartz component
Quartz componentQuartz component
Quartz component
F K
 
Mule management console installation
Mule management console installation Mule management console installation
Mule management console installation
F K
 
Mule esb made system integration easy
Mule esb made system integration easy Mule esb made system integration easy
Mule esb made system integration easy
F K
 
Message properties component
Message properties componentMessage properties component
Message properties component
F K
 
Junit in mule
Junit in muleJunit in mule
Junit in mule
F K
 
Install sonarqube plugin in anypoint
Install sonarqube plugin in anypoint Install sonarqube plugin in anypoint
Install sonarqube plugin in anypoint
F K
 
Commit a project in svn using svn plugin in anypoint studio
Commit a project in svn using svn plugin in anypoint studioCommit a project in svn using svn plugin in anypoint studio
Commit a project in svn using svn plugin in anypoint studio
F K
 
Github plugin setup in anypoint studio
Github plugin setup in anypoint studio Github plugin setup in anypoint studio
Github plugin setup in anypoint studio
F K
 
For each component
For each component For each component
For each component
F K
 
Filter expression
Filter expression Filter expression
Filter expression
F K
 
File component
File component File component
File component
F K
 
Database component
Database component Database component
Database component
F K
 
Choice component
Choice component Choice component
Choice component
F K
 
Mule with drools
Mule with droolsMule with drools
Mule with drools
F K
 
Mule esb Data Weave
Mule esb Data WeaveMule esb Data Weave
Mule esb Data Weave
F K
 

More from F K (20)

WebServices introduction in Mule
WebServices introduction in MuleWebServices introduction in Mule
WebServices introduction in Mule
 
Testing soapui
Testing soapuiTesting soapui
Testing soapui
 
Java For Begineers
Java For BegineersJava For Begineers
Java For Begineers
 
Vm component
Vm componentVm component
Vm component
 
Until successful component in mule
Until successful component in muleUntil successful component in mule
Until successful component in mule
 
Quartz component
Quartz componentQuartz component
Quartz component
 
Mule management console installation
Mule management console installation Mule management console installation
Mule management console installation
 
Mule esb made system integration easy
Mule esb made system integration easy Mule esb made system integration easy
Mule esb made system integration easy
 
Message properties component
Message properties componentMessage properties component
Message properties component
 
Junit in mule
Junit in muleJunit in mule
Junit in mule
 
Install sonarqube plugin in anypoint
Install sonarqube plugin in anypoint Install sonarqube plugin in anypoint
Install sonarqube plugin in anypoint
 
Commit a project in svn using svn plugin in anypoint studio
Commit a project in svn using svn plugin in anypoint studioCommit a project in svn using svn plugin in anypoint studio
Commit a project in svn using svn plugin in anypoint studio
 
Github plugin setup in anypoint studio
Github plugin setup in anypoint studio Github plugin setup in anypoint studio
Github plugin setup in anypoint studio
 
For each component
For each component For each component
For each component
 
Filter expression
Filter expression Filter expression
Filter expression
 
File component
File component File component
File component
 
Database component
Database component Database component
Database component
 
Choice component
Choice component Choice component
Choice component
 
Mule with drools
Mule with droolsMule with drools
Mule with drools
 
Mule esb Data Weave
Mule esb Data WeaveMule esb Data Weave
Mule esb Data Weave
 

Recently uploaded

Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 

Recently uploaded (20)

Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 

Jax ws

  • 1. JAX-WS - Java API for XML Web Services indigoo.com JAX-WS JAVA API FOR XML WEB SERVICES INTRODUCTION TO JAX-WS, THE JAVA API FOR XML BASED WEB SERVICES (SOAP, WSDL)
  • 2. JAX-WS - Java API for XML Web Services Contents 1. What is JAX-WS? 2. Glassfish = Reference implementation for JAX-WS 3. Glassfish projects, Java packages 4. POJO / Java bean as web service class 5. JAX-WS JavaBeans versus provider endpoint 6. JAX-WS dispatch client versus dynamic client proxy API 7. JAX-WS development / deployment 8. JAXB – Binding XML documents to Java objects 9. JAXR – JAVA API for XML Registries 10. WSIT – Web Service Interoperability Technologies 11. Short comparison of important Java WS stacks
  • 3. JAX-WS - Java API for XML Web Services 1. What is JAX-WS? JAX-WS is the core Java web service technology (standard for Java EE):  JAX-WS is the standard programming model / API for WS on Java (JAX-WS became a standard part of Java as of version 1.6).  JAX-WS is platform independent (many Java platforms like Glassfish, Axis2 or CXF support JAX-WS). Services developed on one platform can be easily ported to another platform.  JAX-WS makes use of annotations like @WebService. This provides better scalability (no central deployment descriptor for different WS classes is required).  JAX-WS uses the POJO concept (use of plain Java classes to define web service interfaces).  JAX-WS replaces / supersedes JAX-RPC (= old Java web services, basically RMI over web service). JAX-WS is more document orientiented instead of RPC-oriented. Glassfish is the JAX-WS reference implementation (RI, see https://jax-ws.java.net/).
  • 4. JAX-WS - Java API for XML Web Services Glassfish JEE app. server RI 2. Glassfish = Reference implementation for JAX-WS Glassfish: Metro: JAXB: SAAJ: JAX-WS: WSIT: JAXR: StaX: Java EE reference implementation (RI), reference Java application server. WS stack as part of Glassfish (consists of JAX-WS and WSIT components). Data binding (bind objects to XML documents or fragments). SOAP withAttachments API for Java. Java core web service stack. Web Services Interoperability Technologies (enables interop with .Net). Java API for XML Registries (WS registry). Streaming API for XML. Details see https://glassfish.java.net/downloads/3.1.1-final.html Metro stack JAXB JSR-222 JAX-WS (core WS) JSR-224 Security JAXP StaX JSR-173 RM Trans- actions SAAJ HTTP TCP JMS SMTP WSIT JAX-WS Transports XML Meta- data WSDL Policy Jersey (JAX-RS) CORBA EJB1) 1) Local container only Grizzly / COMET JAXR OpenMQ
  • 5. JAX-WS - Java API for XML Web Services 3. Glassfish projects, Java packages (selection) Glassfish is developed in various independent projects. Together, they build the Glassfish service platform. Parent project Project Description Java package Glassfish GF-CORBA CORBA com.sun.corba.se.* Glassfish OpenMQ JMS javax.jms.* Glassfish WADL IDL for REST services org.vnet.ws.wadl.* org.vnet.ws.wadl2java.* Glassfish JAX-RS, Jersey (=RI) REST services javax.ws.rs.* jax-ws-xml, jwsdp JAXB Java API for XML Binding javax.xml.bind.* jax-ws-xml, jwsdp JAX-RPC Java API for XML RPC Old Java WS (superseded by JAX-WS) java.xml.rpc.* Metro (Glassfish) JAX-WS Java API for XML Web Services javax.jws.* javax.xml.ws.* Metro (Glassfish) SAAJ SOAP attachments javax.xml.soap.* Metro (Glassfish) WSIT (previously Tango) Web Services Interoperability Technologies (WS-Trust etc.) Various
  • 6. JAX-WS - Java API for XML Web Services Called by container before the implementing class is called the first time. Called by container before the implementing class goes out of operation. 4. POJO / Java bean as web service class (1/2) Web services through simple annotations: The programming model of JAX-WS relies on simple annotations. This allows to turn existing business classes (POJOs) into web services with very little effort. Web service endpoints are either explicit or implicit, depending on the definition or absence of a Java interface that defines the web service interface. Implicit SEI (Service Endpoint Interface): Service does not have an explicit service interface, i.e. the class itself is the service interface. @WebService public class HelloWorld { @WebMethod public String sayHello() {...} public HelloWorld() {...} @PostConstruct public void init() {...} @PreDestroy public void teardown() {...} } Through @WebService annotation, the class HelloWorld becomes an SEI (Service Endpoint Interface) and all public methods are exposed. Annotation for individual method to be exposed as a web service method. The SEI implementing class must have a public default ctor.
  • 7. JAX-WS - Java API for XML Web Services Explicit endpoint interface. Reference to explicit service endpoint interface. 4. POJO / Java bean as web service class (2/2) Explicit SEI: The service bean has an associated service endpoint interface (reference to interface). public interface IHello { @WebMethod public String sayHello() {...} } @WebService(endpointInterface=IHello) public class HelloWorld { public String sayHello() {...} }
  • 8. JAX-WS - Java API for XML Web Services 5. JAX-WS JavaBeans versus provider endpoint (1/3) Web services on the service provider side can be defined at 2 levels:  The annotation @WebService is a high-level annotation to turn a POJO into a web service.  The @WebServiceProvider is lower-level and gives more control over the web service. RPC call (API) SOAP engine HTTP engine Application Service consumer Procedure (marshaling) SOAP engine HTTP engine Application @WebService Service provider Application @WebServiceProvider
  • 9. JAX-WS - Java API for XML Web Services 5. JAX-WS JavaBeans versus provider endpoint (2/3) A. JavaBeans endpoints (@WebService annotation): JavaBeans as endpoints allow to expose Java classes (actually methods) as web services. This hides most of the WS complexity to the programmer. JavaBeans endpoint example: @WebService public class HelloWorld { @WebMethod public String sayHello() {...} }
  • 10. JAX-WS - Java API for XML Web Services © Peter R. Egli 2015 5. JAX-WS JavaBeans versus provider endpoint (3/3) B. Provider endpoints (@WebServiceProvider annotation): Provider endpoints are more generic, message-based service implementations. The service operates directly on (SOAP) message level. The service implementation defines 1 generic method "invoke" that accepts a SOAP message and returns a SOAP result. The provider interface allows to operate a web service in payload mode (service method directly receives XML messages). Provider endpoint example: The web service class has only a single method invoke. This method receives the SOAP messages. Decoding of the message takes place in this method. @WebServiceProvider( portName="HelloPort", serviceName="HelloService", targetNamespace="http://helloservice.org/wsdl" , wsdlLocation="WEB- INF/wsdl/HelloService.wsdl" ) @BindingType(value="http://schemas.xmlsoap.org/wsdl/soap/http") @ServiceMode(value=javax.xml.ws.Service.Mode.MESSAGE) public class HelloProvider implements Provider<SOAPMessage> { private static final String helloResponse = ... public SOAPMessage invoke(SOAPMessage req) { ... } }
  • 11. JAX-WS - Java API for XML Web Services 6. JAX-WS dispatch client versus dynamic client proxy API (1/3) Similar to the server APIs, JAX-WS clients may use 2 different APIs for sending web service requests.  A dispatch client gives direct access to XML / SOAP messages.  A dynamic proxy client provides an RPC-like interface to the client application. RPC call (API) SOAP engine HTTP engine Application Service consumer Procedure (marshaling) SOAP engine HTTP engine Application Service provider Dispatch client API Dynamic proxy client API
  • 12. JAX-WS - Java API for XML Web Services 6. JAX-WS dispatch client versus dynamic client proxy API (2/3) A. Dispatch client (dynamic client programming model): The dispatch client has direct access to XML (SOAP) messages. The dispatch client is responsible for creating SOAP messages. It is called dynamic because it constructs SOAP messages at runtime. Dispatch client example (source: axis.apache.org): String endpointUrl = ...; QName serviceName = new QName("http://org/apache/ws/axis2/sample/echo/", "EchoService"); QName portName = new QName("http://org/apache/ws/axis2/sample/echo/", "EchoServicePort"); /** Create a service and add at least one port to it. **/ Service service = Service.create(serviceName); service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointUrl); /** Create a Dispatch instance from a service.**/ Dispatch<SOAPMessage> dispatch = service.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE); /** Create SOAPMessage request message. **/ MessageFactory mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); // Create a message. This example works with the SOAPPART. SOAPMessage request = mf.createMessage(); SOAPPart part = request.getSOAPPart(); // Obtain the SOAPEnvelope and header and body elements. SOAPEnvelope env = part.getEnvelope(); SOAPHeader header = env.getHeader(); SOAPBody body = env.getBody(); // Construct the message payload. SOAPElement operation = body.addChildElement("invoke", "ns1", "http://org/apache/ws/axis2/sample/echo/"); SOAPElement value = operation.addChildElement("arg0"); value.addTextNode("ping"); request.saveChanges(); /** Invoke the service endpoint. **/ SOAPMessage response = dispatch.invoke(request);
  • 13. JAX-WS - Java API for XML Web Services 6. JAX-WS dispatch client versus dynamic client proxy API (3/3) B. Dynamic proxy client (static client programming model): A dynamic proxy client is similar to a stub client in the JAX-RPC programming model (=RPC model). A dynamic proxy client uses a service endpoint interface (SEI) which must be provided. The dynamic proxy client classes are generated at runtime (by the Java dynamic proxy functionality). Dynamic proxy client example: EchoService port = new EchoService().getEchoServicePort(); String echo = port.echo("Hello World");
  • 14. JAX-WS - Java API for XML Web Services principle). wsgen.exe *.java CodeCJoAdXeB classes Annotated Service Endpoint Interface / Implementation (POJO). Public methods are web (exposed) methods or use @WebMethod annotation. SEI (Service Endpoint Interface) = Java class with methods that can be called by client. javac.exe *.class Portable JAXB classes for marshalling / unmarshalling messages WSDL file Service description as WSDL file 7. JAX-WS development / deployment (1/2) 1. Start with POJO / bean class as service class (bottom-up development): Server stub files and (optionally) WSDL files are created from Java class file(s). The deployment descriptor web.xml is optional (JAX-WS defaults are sufficient for many / most applications, "configuration by exception" web.xml (deployment descriptor, optional) Platform specific packaging and deployment WAR, AAR etc.
  • 15. JAX-WS - Java API for XML Web Services 7. JAX-WS development / deployment (2/2) 2. Start with WSDL file (top-down development): Server stub files are created from an existing WSDL file. 3. Creation of client stub files from a WSDL file (dynamic proxy client): wsimport.exe CSoedrever Csotdueb classes WSDL file Portable artefacts for client & server: • Service class • SEI class • Exception class • JAXB classes for marshalling messages Platform specific packaging and deployment web.xml (deployment descriptor, optional) WAR, AAR etc. wsimport.exe WSDL file Cocldieent Csotdueb files
  • 16. JAX-WS - Java API for XML Web Services 8. JAXB – Binding XML documents to Java objects JAX-WS uses JAXB for the binding between Java objects and XML documents. The binding / JAXB details are hidden from the JAX-WS programmer. Schema JJAAXXBB mmaappppeedd cclalasssseess JAXB mapped classes OObbjejecctsts Objects Document (XML) bind unmarshal (validate) marshal (validate) follows instances of JAXB mapping of XML schema built-in types to Java built-in types (selection): Relationship between schema, document, Java objects and classes with JAXB: XML schema type Java data type xsd:string java.lang.String xsd:integer java.math.BigInteger xsd:int int xsd:long long xsd:short short
  • 17. JAX-WS - Java API for XML Web Services 9. JAXR – JAVAAPI for XML Registries JAXR is a uniform and standard API for accessing different kinds of XML registries. XML registries are used for registering (by server / service) and discovering (by client) web services. JAXR follows the well-known pattern in Java with a service provider interface (SPI for registering XML metadata) and a client interface (see also JMS or JNDI). Source: docs.oracle.com JAXR Client ebXML JAXR API Capability-Specific Interfaces UDDI Provider Provider Other Provider ebXML UDDI Other Registry-specific JAXR provider ebXML / SOAP UDDI / SOAP Other Registries
  • 18. JAX-WS - Java API for XML Web Services 10. WSIT – Web Service Interoperability Technologies (1/2) Interoperability is crucial for web services (web services in general claim platform independence and interoperability). WSIT is the standard Java WS protocol stack beyond basic WS functionality (SOAP, WSDL) to achieve interoperability between Java and .Net (for more complex applications that go beyond simple WS requests). JAX-WS defines the WS core stack while WSIT provides many of the WS-* standards required for interoperability. WSIT is an open source project started by Sun Microsystems to promote WS-interoperability with .Net 3.0 (WCF). WSIT is bundled inside the Metro WS stack. The Metro stack in turn is bundled inside Glassfish (see Slide 2). WS-I (Web Service Interoperability) defines profiles (sets of WS standards, see www.oasis-ws-i.org/) for which WS stacks can claim compatibility such as: WS-I Basic Profile 1.1: WS-I Basic Profile 1.2: WS-I Simple SOAP Binding Profile 1.0: SOAP 1.1 + HTTP 1.1 + WSDL 1.1 SOAP 1.1 + HTTP 1.1 + WSDL 1.1 + WS-Addressing 1.0 + MTOM 1.0 SOAP 1.1 + HTTP 1.1 + WSDL 1.1 + UDDI WSIT versus WS-I? WS-I defines profiles while WSIT implements them.
  • 19. JAX-WS - Java API for XML Web Services 10. WSIT – Web Service Interoperability Technologies (2/2) Overview of WS-standards compliance by JAX-WS / Metro-stack and WCF: Standard JAX-WS (Metro@Glassfish) Microsoft WCF Description WS-I Basic Profile Yes (JAX-WS) Yes SOAP 1.1 + HTTP 1.1 + WSDL 1.1. WS-MetadataExchange Yes (WSIT) Yes Exchange of web service meta-data files. WS-Transfer Yes (WSIT) Yes Protocol for accessing XML-representations of WS resources. WS-Policy Yes (WSIT) Yes XML-representations of WS policies (security, QoS). WS-Security Yes (WSIT) Yes Framework protocol for applying security to web services. WS-SecureConversation Yes (WSIT) Yes Protocol for sharing security contexts between sites. WS-Trust Yes (WSIT) Yes Protocol for establishing trust between WS provider and consumer. WS-SecurityPolicy Yes (WSIT) Yes Set of security policy assertions to be used with WS-Policy. WS-ReliableMessaging Yes (WSIT) Yes Protocol for reliable WS message delivery (in-order, exactly-once). WS-RMPolicy Yes (WSIT) Yes XML-representations of WS policies of RM-WS-endpoints. WS-Coordination Yes (WSIT) Yes Protocol for coordinating web service participants (providers, consumers). WS-AtomicTransaction Yes (WSIT) Yes Protocol for atomic transactions with groups of web services. WS-BusinessActivity No Yes (.Net 4.0) Business activity coordination to be used in the WS-Coordination framework. WS-Eventing No No Protocol for subscribe / publish to WS for receiving notifications. WS-Notification No No Protocol for subscribe / publish to topic-based WS for receiving notifications.
  • 20. JAX-WS - Java API for XML Web Services 11. Short comparison of important Java WS stacks 1. JAX-WS (Glassfish RI):  JAX-WS compliant (the reference implementation defines the standard).  Supported by many WS frameworks. 2. Apache CXF framework:  Easy to use, slim. 3. Apache Axis2:  Features-rich, but also high complexity.  Not (fully) JAX-WS compliant (not JAX-WS technology compatibility kit compliant).  Support for different XML-Java binding frameworks (XMLBeans etc.). 4. JBoss:  Actually uses Glassfish / Metro as WS-stack (http://jbossws.jboss.org/). 5. Spring WS:  Contract-first development (first WSDL, then code).  Support for different XML-Java binding frameworks (XMLBeans, JiXB etc.). Comparison of Java WS stacks se also http://wiki.apache.org/ws/StackComparison.