19 copyright © 2005, oracle. all rights reserved. distributing modular applications: developing web...

25
19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

Upload: emily-garza

Post on 27-Mar-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19Copyright © 2005, Oracle. All rights reserved.

Distributing Modular Applications: Developing Web Services

Page 2: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-2 Copyright © 2005, Oracle. All rights reserved.

Objectives

After completing this lesson, you should be able to do the following:

• Identify the components that can be exposed as Web services with Oracle Application Server 10g

• Develop, deploy, and test a stateless Java class Web service by using Oracle JDeveloper 10g

• Use the Web services home page to test the deployed Web service

• Identify the steps that are involved in exposing a PL/SQL stored procedure as a Web service

Page 3: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-3 Copyright © 2005, Oracle. All rights reserved.

Oracle Application Server 10g Web Services

Oracle Application Server 10g Web services can be implemented as any of the following:• Stateless and stateful

Java classes• Stateless PL/SQL

packages• Stateless session

Enterprise JavaBeans (EJBs)

• Java Message Service (JMS) destinations

Page 4: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-4 Copyright © 2005, Oracle. All rights reserved.

Developing a Web Service with a Stateless Java Class

1. Define an interface.

2. Define a stateless Java class.

3. Generate an .ear file.

4. Deploy the generated .ear file to Oracle Application Server 10g.

Page 5: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-5 Copyright © 2005, Oracle. All rights reserved.

Defining an Interface

Page 6: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-6 Copyright © 2005, Oracle. All rights reserved.

Defining an Interface

Page 7: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-7 Copyright © 2005, Oracle. All rights reserved.

Defining a Stateless Java Class

Page 8: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-8 Copyright © 2005, Oracle. All rights reserved.

Defining a Stateless Java Class

Page 9: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-10 Copyright © 2005, Oracle. All rights reserved.

Creating the Web Service

Page 10: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-11 Copyright © 2005, Oracle. All rights reserved.

Creating the Client Application

Page 11: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-12 Copyright © 2005, Oracle. All rights reserved.

Creating the Client Application

Page 12: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-13 Copyright © 2005, Oracle. All rights reserved.

Deploying the Web Service

Page 13: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-14 Copyright © 2005, Oracle. All rights reserved.

Testing the Web Service

Page 14: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-15 Copyright © 2005, Oracle. All rights reserved.

Web Service Home Page

A Web service home page provides:

• A link to the service description (WSDL file)

• Links to Web service test pages to test the available operations of the Web service

• Links to the Web service client-side Proxy Jar

• Links to the Web service client-side Proxy Source

Page 15: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-16 Copyright © 2005, Oracle. All rights reserved.

Testing the Deployed Web Service with Home Page

Page 16: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-17 Copyright © 2005, Oracle. All rights reserved.

Testing the sayHello Operation

Page 17: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-18 Copyright © 2005, Oracle. All rights reserved.

Testing the sayHello Operation

Page 18: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-19 Copyright © 2005, Oracle. All rights reserved.

Serializing and Encoding Parameters and Results

• Oracle Application Server 10g Web services support a prepackaged implementation for handling encoding, decoding, serialization, and deserialization.

• Oracle Application Server 10g supports the following encoding mechanisms:

– Standard SOAP v.1.1 encoding

– Literal XML encoding

Page 19: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-20 Copyright © 2005, Oracle. All rights reserved.

Developing a Stored Procedure Web Service

1. Set up data sources in OC4J by configuring the data-sources.xml file in the ORACLE_HOME\j2ee\home\config folder.

2. Generate the Java wrapper classes for the PL/SQL package and generate the EAR file.

3. Deploy the EAR file to Oracle Application Server 10g or stand-alone OC4J to expose it as a Web service.

Page 20: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-21 Copyright © 2005, Oracle. All rights reserved.

Generating Wrapper Classes Using JPublisher

Database JPublisher Java classes

Page 21: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-22 Copyright © 2005, Oracle. All rights reserved.

Exposing a Function as a Web Service by Using Oracle JDeveloper 10g

Page 22: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-23 Copyright © 2005, Oracle. All rights reserved.

Publishing the Package as a Web Service

Page 23: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-24 Copyright © 2005, Oracle. All rights reserved.

JMS Web Services

• Oracle Application Server 10g supplies a servlet to support two operations on messages:– Send operation – Receive operation

• The JMS Web service determines how to handle incoming and outgoing messages from JMS destinations.

• JMS messages can be processed on the server side by:– Message-Driven Bean (MDB) – JMS client

Page 24: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-26 Copyright © 2005, Oracle. All rights reserved.

Summary

In this lesson, you should have learned how to:

• Expose a stateless Java class as a Web service

• Test the Web service with the Web service home page

• Use Oracle JDeveloper 10g to develop, deploy, and test Web services

• Expose a PL/SQL stored procedure as a Web service

Page 25: 19 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Developing Web Services

19-27 Copyright © 2005, Oracle. All rights reserved.

Practice 19-1: Overview

This practice covers the following topics:

• Exposing a stateless session bean as Web service by using Oracle JDeveloper 10g

• Deploying the Web service to an embedded OC4J server and testing it with a client application

• Deploying the Web service to Oracle Application Server 10g and testing it with the Web services home page