Implementing a Custom Spring Bean as an Event Source

17 Configuring Web Services 17-1 17 Configuring Web Services You can use Web Services from within an Oracle CEP application. This chapter describes: ■ Section 17.1, Understanding Oracle CEP and Web Services ■ Section 17.2, How to Invoke a Web Service From an Oracle CEP Application ■ Section 17.3, How to Expose an Oracle CEP Application as a Web Service

17.1 Understanding Oracle CEP and Web Services

You can integrate an Oracle CEP application with other systems using Web Services. Oracle CEP supports version 2.0 of the JAX-WS API standard using the Glassfish reference implementation of JAX-WS 2.0, including: ■ JAX-WS 2.0 Java API for XML Web Services, defined in JSR 224 ■ WS-I Basic Profile 1.1 ■ WS-I Attachments Profile 1.0 SOAP Messages with Attachments ■ WS-I Simple SOAP Binding Profile 1.0 ■ SOAP 1.1 and 1.2 Simple Object Access Protocol ■ MTOM Message Transmission Optimization Mechanism ■ WSDL 1.1 Web Services Definition Language ■ JAXB 2.0 Java API for XML Binding, references through a separate JAXB module ■ SAAJ 1.3 SOAP with Attachments API for Java

17.2 How to Invoke a Web Service From an Oracle CEP Application

This procedure describes how to create an Oracle CEP application that invokes a Web Service. In this scenario, the Oracle CEP application is the Web Service client. To invoke a Web Service from an Oracle CEP application: 1. Create or obtain the WSDL for the Web Service. In this example, assume the use of a WSDL named EchoService.WSDL. 2. Generate the compiled .class files you will use to invoke the Web Service in practice, the command should be on one line: java -cp OCEP_HOME_DIRmodulescom.bea.core.ws.glassfish.jaxws.tools_ 17-2 Oracle Complex Event Processing Developers Guide 9.0.0.0.jar com.sun.tools.ws.WsImport EchoService.WSDL Where ORACLE_CEP_HOME refers to the directory in which you installed Oracle CEP such as oracle_home. 3. Archive the generated .class files within the Oracle CEP application JAR file. For more information, see Section 4.7, Managing Libraries and Other Non-Class Files in Oracle CEP Projects . 4. Export the Web-Services Java packages for the client-code in the MANIFEST.MF file using the Export-Package header: Export-Package: com.oracle.ocep.sample.echoService; For more information, see Section 4.7.4, How to Export a Package . 5. Import the following packages to the Oracle CEP application in the MANIFEST.MF file using the Import-Package header: Import-Package: com.ctc.wstx.stax, com.sun.xml.bind.v2, com.sun.xml.messaging.saaj.soap, com.sun.xml.messaging.saaj.soap.ver1_1, com.sun.xml.ws, javax.jws, javax.xml.bind, javax.xml.bind.annotation, javax.xml.namespace, javax.xml.soap, javax.xml.transform, javax.xml.transform.stream, javax.xml.ws, javax.xml.ws.spi, org.xml.sax, weblogic.xml.stax; For more information, see Section 4.7, Managing Libraries and Other Non-Class Files in Oracle CEP Projects . 6. Use the client-code to invoke the Web Service as in any other Java application: EchoService service = new EchoService; EchoPort port = service.getEchoServicePort; String echo = port.echofoo;

17.3 How to Expose an Oracle CEP Application as a Web Service

This procedure describes how to expose an Oracle CEP application as a Web Service. In this scenario, the Oracle CEP application is the Web Service provider. To expose an Oracle CEP application as a Web service: 1. Create or obtain the WSDL for the Web Service. In this example, assume the use of a WSDL named EchoService.WSDL. 2. Implement the service. Consider using java.jws annotations WebService and WebMethod. 3. Add a bea-jaxws.xml file to your application bundle as Example 17–1 shows. Table 17–1 describes the attributes in this file.