More Related Content
Similar to Deawsj 7 ppt-2_a
Similar to Deawsj 7 ppt-2_a (20)
Deawsj 7 ppt-2_a
- 1. Developing Web Services Using JAX-RPC
Pre-assessment Questions
1. ___________ is a collection of document-oriented APIs that enable you
to process and transform XML documents using Java-based
applications.
a. JAXP
b. JAXM
c. JAXR
d. JAX-RPC
©NIIT XML and Web Services Lesson 2A / Slide 1 of 19
- 2. Developing Web Services Using JAX-RPC
Pre-assessment Questions (Contd.)
1. Which of the following API is used to transform the XML document into
other formats?
a. SAX API
b. DOM API
c. XSLT API
d. JAXP API
©NIIT XML and Web Services Lesson 2A / Slide 2 of 19
- 3. Developing Web Services Using JAX-RPC
Pre-assessment Questions (Contd.)
1. Consider the following two statements:
Statement A: SAX parses XML document faster then DOM
Statement B: SAX builds an object tree of the XML document
during parsing
Identify the correct option:
a. Both Statement A and B are false
b. Both Statement A and B are true
c. Statement A is true while B is false
d. Statement A is false while B is true
©NIIT XML and Web Services Lesson 2A / Slide 3 of 19
- 4. Developing Web Services Using JAX-RPC
Pre-assessment Questions (Contd.)
1. DOM parsers consume more memory compared to SAX because:
a. DOM serially parses the XML document from beginning to end of
the document .
b. DOM stores the entire document as an object tree representation
in the memory.
c. DOM transforms the XML document after parsing it.
d. DOM creates a single object in memory to represent the XML
document.
©NIIT XML and Web Services Lesson 2A / Slide 4 of 19
- 5. Developing Web Services Using JAX-RPC
Pre-assessment Questions (Contd.)
1. Select the package that contains the interface whose parse() method is
used to parse XML documents using DOM.
a. org.xml.sax.helpers
b. javax.xml.parsers
c. org.w3c.dom
d. javax.xml.transform
©NIIT XML and Web Services Lesson 2A / Slide 5 of 19
- 6. Developing Web Services Using JAX-RPC
Solutions to Pre-assessment
Questions
• a. JAXP
• c. XSLT API
• c. Statement A is true while B is false
• b. DOM stores the entire document as an object tree representation in
the memory.
• b. javax.xml.parsers
©NIIT XML and Web Services Lesson 2A / Slide 6 of 19
- 7. Developing Web Services Using JAX-RPC
Objectives
In this lesson, you will learn about:
• Java API for XML-based RPC (JAX-RPC)
• Steps to create Web services using JAX-RPC
• Steps to create Web clients using JAX-RPC
©NIIT XML and Web Services Lesson 2A / Slide 7 of 19
- 8. Developing Web Services Using JAX-RPC
Java API for XML-Based RPC (JAX-
RPC)
• The JAX-RPC API is used to develop portable and interoperable Web services
and Web service clients.
• The JAX-RPC hides the structure, encoding rules and conventions of the SOAP
protocol to transfer remote procedure calls between a Web service client and a
Web service using SOAP messages .
©NIIT XML and Web Services Lesson 2A / Slide 8 of 19
- 9. Developing Web Services Using JAX-RPC
Java API for XML-Based RPC (JAX-
RPC) (Contd.)
• JAX-RPC Working Mechanism
• The JAX-RPC Web service provides methods that can be accessed by the
remote clients.
• The Web service client invokes the method on the Web service.
• The method call is passed to the stub, which is a client side
implementation of Web service object.
• The stub passes the method call to the JAX-RPC runtime system on the
client side.
• The JAX-RPC runtime system converts the method call into SOAP message
and transmits the SOAP message over the network.
• The JAX-RPC runtime system on the server side receives the data and
invokes the method provided on the tie object.
©NIIT XML and Web Services Lesson 2A / Slide 9 of 19
- 10. Developing Web Services Using JAX-RPC
Java API for XML-Based RPC (JAX-
RPC) (Contd.)
• JAX-RPC Working Mechanism(Contd.)
• The tie object converts the SOAP message into method call and invokes
the method on the Web service.
• The Web service processes the client request and returns the result to the
tie object.
• The tie object creates the response message and passes the response
message to the JAX-RPC runtime system.
• The JAX-RPC runtime system converts the response message into SOAP
message and transmits the message to the Web service client.
• The JAX-RPC runtime system on the client side receives the server
response and passes it to the client.
©NIIT XML and Web Services Lesson 2A / Slide 10 of 19
- 11. Developing Web Services Using JAX-RPC
Java API for XML-Based RPC (JAX-
RPC) (Contd.)
• The following figure shows the communication between the JAX-RPC client
and a Web Service:
©NIIT XML and Web Services Lesson 2A / Slide 11 of 19
- 12. Developing Web Services Using JAX-RPC
Java API for XML-Based RPC (JAX-
RPC) (Contd.)
• The packages in the JAX-RPC API are:
• javax.xml.rpc
• javax.xml.rpc.encoding
• javax.xml.rpc.handler
• javax.xml.rpc.handler.soap
• javax.xml.rpc.holders
• javax.xml.rpc.server
• javax.xml.rpc.soap
©NIIT XML and Web Services Lesson 2A / Slide 12 of 19
- 13. Developing Web Services Using JAX-RPC
Java API for XML-Based RPC (JAX-
RPC) (Contd.)
• The JAX-RPC does not support all the data types and classes provided by
J2SE.
• Only those Java data types and classes that map with XML/WSDL definition
can be used while creating Web services and Web service clients using JAX-
RPC API.
©NIIT XML and Web Services Lesson 2A / Slide 13 of 19
- 14. Developing Web Services Using JAX-RPC
Java API for XML-Based RPC (JAX-
RPC) (Contd.)
• The Java data types supported by JAX-RPC are:
• byte
• short
• int
• long
• float
• double
• boolean
©NIIT XML and Web Services Lesson 2A / Slide 14 of 19
- 15. Developing Web Services Using JAX-RPC
Java API for XML-Based RPC (JAX-
RPC) (Contd.)
• The Java classes supported by JAX-RPC are:
• java.lang.Byte
• java.lang.Short
• java.lang.Integer
• java.lang.Long
• java.lang.Float
• java.lang.Double
• java.lang.Boolean
• java.lang.String
• java.util.Date
• java.util.Calendar
©NIIT XML and Web Services Lesson 2A / Slide 15 of 19
- 16. Developing Web Services Using JAX-RPC
Creating a JAX-RPC Web Service
• Creating a JAX-RPC Web service involves:
• Creating the Web service endpoint interface
• Creating the Web service implementation class
• Creating the configuration file
• Generating the WSDL and mapping file of the Web service
• Packaging and Deploying the Web service
©NIIT XML and Web Services Lesson 2A / Slide 16 of 19
- 17. Developing Web Services Using JAX-RPC
Creating a JAX-RPC Web Service
Client
• Creating a stand alone static stub Web service client involves:
• Coding the Web service client
• Creating a configuration file
• Generating the necessary runtime class files
• Compiling the client
• Executing the client
©NIIT XML and Web Services Lesson 2A / Slide 17 of 19
- 18. Developing Web Services Using JAX-RPC
Creating a JAX-RPC Web Service
Client (Contd.)
• Creating a J2EE Web client involves:
• Coding the Web client
• Creating a configuration file
• Generating the necessary runtime class files
• Compiling the client
• Packaging, Configuring, and Deploying the Web client
• Executing the client
©NIIT XML and Web Services Lesson 2A / Slide 18 of 19
- 19. Developing Web Services Using JAX-RPC
Summary
In this lesson, you learned that:
• Architecture of JAX-RPC, which explains how a Web service client invoke
the methods of a Web service .
• The classes and data types supported by JAX-RPC. You cannot use all
the classes and data types defined in J2SDK specification.
• Creating portable and interoperable Web services and Web service
client using JAX-RPC. Using wscompile tool to compile a Web service
and generate a WSDL file.
• Steps to create static stub client and Web client that invokes the
methods of Web service.
©NIIT XML and Web Services Lesson 2A / Slide 19 of 19