Skip Headers
Oracle® Fusion Middleware Developer's Guide for Oracle Event Processing
11g Release 1 (11.1.1.7) for Eclipse

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

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

14 Integrating Web Services

This chapter describes how to configure web services for use with Oracle Event Processing, including how to invoke services from an Oracle Event Processing application and expose an Oracle Event Processing application as a web service.

This chapter includes the following sections:

14.1 Understanding Oracle Event Processing and Web Services

You can integrate an Oracle Event Processing application with other systems using Web Services.

Oracle Event Processing supports version 2.0 of the JAX-WS API standard using the Glassfish reference implementation of JAX-WS 2.0, including:

14.2 How to Invoke a Web Service From an Oracle Event Processing Application

This procedure describes how to create an Oracle Event Processing application that invokes a Web Service. In this scenario, the Oracle Event Processing application is the Web Service client.

To invoke a Web Service from an Oracle Event Processing 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 Event Processing (such as /oracle_home).

  3. Archive the generated .class files within the Oracle Event Processing application JAR file.

    For more information, see Section 5.7, "Managing Libraries and Other Non-Class Files in Oracle Event Processing 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 5.7.4, "How to Export a Package".

  5. Import the following packages to the Oracle Event Processing 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 5.7, "Managing Libraries and Other Non-Class Files in Oracle Event Processing 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");
    

14.3 How to Expose an Oracle Event Processing Application as a Web Service

This procedure describes how to expose an Oracle Event Processing application as a Web Service. In this scenario, the Oracle Event Processing application is the Web Service provider.

To expose an Oracle Event Processing 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 14-1 shows. Table 14-1 describes the attributes in this file.

    Example 14-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 14-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 web service.

    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 5.7, "Managing Libraries and Other Non-Class Files in Oracle Event Processing 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 5.7, "Managing Libraries and Other Non-Class Files in Oracle Event Processing Projects".

  5. Import the following packages to the Oracle Event Processing 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 5.7, "Managing Libraries and Other Non-Class Files in Oracle Event Processing Projects".

  6. Add a glassfish-ws element to the Oracle Event Processing server DOMAIN_DIR/config/config.xml file that describes your Oracle Event Processing domain, where DOMAIN_DIR refers to your domain directory:

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