Skip Headers
Oracle® Complex Event Processing Developer's Guide
11g Release 1 (11.1.1.4.0) for Eclipse

Part Number E14301-04
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

17 Configuring Web Services

You can use Web Services from within an Oracle CEP application.

This chapter describes:

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:

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_DIR/modules/com.bea.core.ws.glassfish.jaxws.tools_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.echo("foo");
    

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.

    Example 17-1 bea-jaxws.xml File

    <endpoints>
      <endpoint>
        <name>EchoService</name>
        <implementation-class>
          com.bea.wlevs.test.echo.impl.EchoServiceImpl
        </implementation-class>
        <url-pattern>/echo</url-pattern>
        <wsdl-location>
          /META-INF/wsdl/echo.wsdl
        </wsdl-location>
        <service-name>
          {http://wsdl.oracle.com/examples/cep/echo}EchoService
        </service-name>
        <port-name>
          {http://wsdl.oracle.com/examples/cep/echo}EchoServicePort
        </port-name>
      </endpoint>
    </endpoints>
    

    Table 17-1 bea-jaxws.xml File Attributes

    Attribute Description

    name

    The name of the web service.

    implementation-class

    The class that implements the service.

    url-pattern

    The url pattern to access the webservice.

    wsdl-location

    Relative path to the wsdl in the bundle.

    service-name

    QName of the service.

    port-name

    QName of the port.


    For more information, see Section 4.7, "Managing Libraries and Other Non-Class Files in Oracle CEP Projects".

  4. Reference the bea-jaxws.xml file in the MANIFEST.MF file using the BEA-JAXWS-Descriptor header:

    BEA-JAXWS-Descriptor: META-INF/bea-jaxws.xml;
    

    For more information, see Section 4.7, "Managing Libraries and Other Non-Class Files in Oracle CEP Projects".

  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.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. Add a glassfish-ws element to the Oracle CEP server DOMAIN_DIR/config/config.xml file that describes your Oracle CEP domain, where DOMAIN_DIR refers to your domain directory:

    <glassfish-ws>
        <name>JAXWS</name>
        <http-service-name>JettyServer</http-service-name>
    </glassfish-ws>