Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Distributing Modular Applications: Developing Web Services Copyright © 2004, 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 19-2 Copyright © 2004, 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 19-3 Copyright © 2004, Oracle. All rights reserved. Developing a Web Service with a Stateless Java Class 1. 2. 3. 4. 19-4 Define an interface. Define a stateless Java class. Generate an .ear file. Deploy the generated .ear file to Oracle Application Server 10g. Copyright © 2004, Oracle. All rights reserved. Defining an Interface 19-5 Copyright © 2004, Oracle. All rights reserved. Defining an Interface 19-6 Copyright © 2004, Oracle. All rights reserved. Defining a Stateless Java Class 19-7 Copyright © 2004, Oracle. All rights reserved. Defining a Stateless Java Class 19-8 Copyright © 2004, Oracle. All rights reserved. Creating the Web Service 19-10 Copyright © 2004, Oracle. All rights reserved. Creating the Client Application 19-11 Copyright © 2004, Oracle. All rights reserved. Creating the Client Application 19-12 Copyright © 2004, Oracle. All rights reserved. Deploying the Web Service 19-13 Copyright © 2004, Oracle. All rights reserved. Testing the Web Service 19-14 Copyright © 2004, 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 19-15 Copyright © 2004, Oracle. All rights reserved. Testing the Deployed Web Service with Home Page 19-16 Copyright © 2004, Oracle. All rights reserved. Testing the sayHello Operation 19-17 Copyright © 2004, Oracle. All rights reserved. Testing the sayHello Operation 19-18 Copyright © 2004, Oracle. All rights reserved. Serializing and Encoding Parameters and Results • • 19-19 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 Copyright © 2004, 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. 19-20 Copyright © 2004, Oracle. All rights reserved. Generating Wrapper Classes Using JPublisher Database 19-21 JPublisher Copyright © 2004, Oracle. All rights reserved. Java classes Exposing a Function as a Web Service by Using Oracle JDeveloper 10g 19-22 Copyright © 2004, Oracle. All rights reserved. Publishing the Package as a Web Service 19-23 Copyright © 2004, 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 19-24 Copyright © 2004, 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 19-26 Copyright © 2004, 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 19-27 Copyright © 2004, Oracle. All rights reserved.