Professional Documents
Culture Documents
1. Web Service
2. RESTful web service
3. SOAP web service
4. SOAP vs REST
5. SOAP example
6. REST example
7. REST JSON
8. REST CRUD
9. Spring Rest
10. Spring Rest JSON
11. Spring Rest XML
12. Spring Rest CRUD
13. Spring Rest Hibernate
14. Spring Hibernate CRUD
15. Rest AngularJS example
16. Spring RestTemplate
17. Android Rest example
18. Web services interview questions
19. Restful web services interview questions
Table of Contents
Preface .....................................................
Who Should Read This Book? .....................................
Organization .................................................
Software and Versions ..........................................
Conventions .................................................
Comments and Questions ........................................
Acknowledgments .............................................
1123445
1. Welcome to Web Services .......................................
1.1 What Are Web Services? ......................................
1.2 Web Services Adoption Factors ..................................
1.3 Web Services in a J2EE Environment ..............................
1.4 What This Book Discusses .....................................
66
11
14
15
2. Inside the Composite Computing Model ............................
2.1 Service-Oriented Architecture ...................................
2.2 The P2P Model ............................................
17
17
26
3. SOAP: The Cornerstone of Interoperability ..........................
3.1 Simple ..................................................
3.2 Object ..................................................
3.3 Access ..................................................
3.4 Protocol .................................................
3.5 Anatomy of a SOAP Message ...................................
3.6 Sending and Receiving SOAP Messages ............................
3.7 The Apache SOAP Routing Service ...............................
3.8 SOAP with Attachments ......................................
28
28
29
29
30
30
34
46
50
4. SOAP-RPC, SOAP-Faults, and Misunderstandings .....................
4.1 SOAP-RPC ...............................................
4.2 Error Handling with SOAP Faults ................................
4.3 SOAP Intermediaries and Actors .................................
55
55
63
69
5. Web Services Description Language ...............................
5.1 Introduction to WSDL ........................................
5.2 Anatomy of a WSDL Document .................................
5.3 Best Practices, Makes Perfect ...................................
5.4 Where Is All the Java? ........................................
72
72
73
94
95
6. UDDI: Universal Description, Discovery, and Integration ................
6.1 UDDI Overview ............................................
6.2 UDDI Specifications and Java-Based APIs ..........................
6.3 Programming UDDI .........................................
6.4 Using WSDL Definitions with UDDI ..............................
96
96
99
101
135
7. JAX-RPC and JAXM .........................................
7.1 Java API for XML Messaging (JAXM) .............................
7.2 JAX-RPC ................................................
7.3 SOAPElement API ..........................................
7.4 JAX-RPC Client Invocation Models ...............................
138
138
157
161
162
8. J2EE and Web Services ........................................
8.1 The SOAP-J2EE Way ........................................
8.2 The Java Web Service (JWS) Standard .............................
169
169
183
www.it-ebooks.info
9. Web Services Interoperability ....................................
9.1 The Concept of Interoperability ..................................
9.2 The Good, Bad, and Ugly of Interoperability .........................
9.3 Potential Interoperability Issues ..................................
9.4 SOAPBuilders Interoperability ..................................
9.5 Other Interoperability Resources .................................
9.6 Resources ................................................
186
186
186
198
200
223
225
10. Web Services Security ........................................
10.1 Incorporating Security Within XML ..............................
10.2 XML Digital Signatures ......................................
10.3 XML Encryption ..........................................
10.4 SOAP Security Extensions ....................................
10.5 Further Reading ...........................................
227
227
228
233
239
241
A. Credits ...................................................
243
Colophon ....................................................
245
1. SOAP
2. WSDL
3. UDDI
SOAP
SOAP is an acronym for Simple Object Access Protocol.
SOAP is XML based, so it is platform independent and language independent. In other words, it can be used
with Java, .Net or PHP language on any platform.
WSDL
WSDL is an acronym for Web Services Description Language.
WSDL is a xml document containing information about web services such as method name, method
parameter and how to access it.
UDDI
UDDI is an acronym for Universal Description, Discovery and Integration.
UDDI is a XML based framework for describing, discovering and integrating web services.
UDDI is a directory of web service interfaces described by WSDL, containing information about web
services.
SOAP stands for Simple Object Access Protocol. It is a XML-based protocol for accessing web services.
SOAP is XML based protocol. It is platform independent and language independent. By using SOAP, you
will be able to interact with other programming language applications.
Language and Platform independent: SOAP web services can be written in any programming language and
executed in any platform.
Disadvantages of Soap Web Services
Slow: SOAP uses XML format that must be parsed to be read. It defines many standards that must be
followed while developing the SOAP applications. So it is slow and consumes more bandwidth and resource.
WSDL dependent: SOAP uses WSDL and doesn't have any other mechanism to discover the service.
Language and Platform independent: RESTful web services can be written in any programming language
and executed in any platform.
Can use SOAP: RESTful web services can use SOAP web services as the implementation.
Permits different data format: RESTful web service permits different data format such as Plain Text,
HTML, XML and JSON.
There are many differences between SOAP and REST web services. The important 10 differences between
SOAP and REST are given below:
No. SOAP REST
SOAP can't use REST because it is a REST can use SOAP web services because it is a concept and can use
3)
protocol. any protocol like HTTP, SOAP.
REST permits different data format such as Plain text, HTML, XML,
9) SOAP permits XML data format only.
JSON etc.
10) SOAP is less preferred than REST. REST more preferred than SOAP.
Service Oriented Architecture or SOA is a design pattern. It is designed to provide services to other
applications through protocol. It is a concept only and not tied to any programming language or platform.
Service
A service is well-defined, self-contained function that represents unit of functionality. A service can exchange
information from another service. It is not dependent on the state of another service.
Service Connections
The figure given below illustrates the service oriented architecture. Service consumer sends service request to
the service provider and service provider sends the service response to the service consumer. The service
connection is understandable to both service consumer and service provider.
Java web services tutorial provides concepts and examples of two main java web services api: JAX-WS and
JAX-RS. The java web service application can be accessed by other programming languages such as .Net and
PHP.
Java web service application perform communication through WSDL (Web Services Description Language).
There are two ways to write java web service application code: SOAP and RESTful.
1) JAX-WS: for SOAP web services. The are two ways to write JAX-WS application code: by RPC style and
Document style.
2) JAX-RS: for RESTful web services. There are mainly 2 implementation currently in use for creating JAX-
RS application: Jersey and RESTeasy.
JAX-WS Tutorial
JAX-WS tutorial is provides concepts and examples of JAX-WS API. This JAX-WS tutorial is designed for
beginners and professionals.