6 Oracle JCA Adapter for Sockets

Learn how to use Oracle JCA Adapter for Sockets (Oracle Socket Adapter), which works with Oracle BPEL Process Manager (Oracle BPEL PM) and Oracle Mediator (Mediator) as an external service.

6.1 Introduction to Oracle Socket Adapter

Oracle Socket Adapter is a JCA 1.5 compliant adapter for modeling standard or nonstandard protocols for communication over TCP/IP sockets. You can use an Oracle Socket Adapter to create a client or a server socket, and establish a connection. The data that is transported can be text or binary.

6.1.1 Oracle Socket Adapter Architecture

Oracle Socket Adapter is based on the JCA 1.5 architecture. JCA provides a standard architecture for integrating heterogeneous enterprise information systems (EIS). The JCA Binding Component of the Oracle Socket Adapter exposes the underlying JCA interactions as services (WSDL with JCA binding) for Oracle BPEL PM integration. Figure 6-1 illustrates the architecture of Oracle Socket Adapter. For details about the Oracle JCA Adapter architecture, see Architecture.

Figure 6-1 Oracle Socket Adapter Architecture

Description of Figure 6-1 follows
Description of "Figure 6-1 Oracle Socket Adapter Architecture"
6.1.1.1 Socket Adapter Message Rejection and Resubmission Not Used

Note that the Socket Adapter does not support the message rejection and retry functionality that is applicable to other JCA Adapters.

Usually the client socket application that connects to the server socket performs the error handling when there is an exception from the downstream adapter. Because message rejections in Socket adapter are not supported, thExaltessage re-submission feature is not used in the Socket Adapter.

6.1.2 Oracle Socket Adapter Integration with Mediator

Oracle Socket Adapter is automatically integrated with Mediator. When you create an Oracle Socket Adapter service in JDeveloper Designer, the Adapter Configuration Wizard is started. This wizard enables you to configure the Oracle Socket Adapter. When configuration is complete, a WSDL file of the same name is created in the Application Navigator section of Oracle JDeveloper (JDeveloper). This WSDL file contains the configuration information you specify in the Adapter Configuration Wizard.

The Operation Type page of the Adapter Configuration Wizard prompts you to select an operation to perform. Based on your selection, different Adapter Configuration Wizard pages appear and prompt you for configuration information.

For more information about Oracle JCA Adapter integration with Mediator, see Adapter Integration with Oracle Fusion Middleware.

6.1.3 Oracle Socket Adapter Integration with Oracle BPEL PM

Oracle Socket Adapter is automatically integrated with Oracle BPEL PM. When you drag and drop Socket Adapter from the Components window of Oracle JDeveloper, the Adapter Configuration Wizard starts that helps you configure an Oracle Socket Adapter.

When configuration is complete, a WSDL file of the same name is created in the Application Navigator section of JDeveloper. This WSDL file contains the configuration information you specify in the Adapter Configuration Wizard.

The Operation Type page of the Adapter Configuration Wizard prompts you to select an operation to perform. Based on your selection, different Adapter Configuration Wizard pages appear and prompt you for configuration information.

For more information about Oracle JCA Adapter integration with Oracle BPEL PM, see Adapter Integration with Oracle Fusion Middleware.

6.1.4 Oracle Socket Adapter Integration with SOA Composite

A composite is an assembly of services, service components (Oracle BPEL PM and Mediator), wires, and references designed and deployed in a single application. The composite processes the information described in the messages. The details of the composite are stored in the composite.xml file. For more information on integration of the Oracle Socket Adapter with SOA composite, see Oracle SOA Composite Integration with Adapters.

6.2 Oracle Socket Adapter Features

Oracle Socket Adapter enables you to configure a BPEL process or a Mediator service to read and write data over TCP/IP sockets.

Oracle Socket Adapter includes the following features:

  • Allows modeling of standard or nonstandard protocols for communication over TCP/IP sockets

  • Supports both inbound and outbound communication

  • Allows you to model complex protocol handshakes declaratively, by using XSL

  • Allows you the option of plugging in custom Java code to model a protocol handshake

  • Provides support for reading and writing native data over sockets as the adapter is integrated with the translator infrastructure (NXSD)

  • Supports multiple character encoding

6.3 Oracle Socket Adapter Concepts

Get an overview of Oracle Socket Adapter concepts.

6.3.1 Communication Modes

Oracle Socket Adapter supports inbound and outbound communication over sockets that can be unidirectional or bidirectional. The communication modes of Oracle Socket Adapter are discussed in the following sections:

6.3.1.1 Inbound Synchronous Request/Response

As part of inbound activation, the Oracle Socket Adapter opens a server socket and waits for incoming connections. The adapter uses the connection to the server socket and reads the request message, which is published to BPEL or Mediator. The Oracle Socket Adapter then uses the same connection to send the response back synchronously.

Figure 6-2 illustrates an inbound synchronous request/response scenario.

Figure 6-2 BPEL Scenario of Inbound Synchronous Request/Response

Description of Figure 6-2 follows
Description of "Figure 6-2 BPEL Scenario of Inbound Synchronous Request/Response"
6.3.1.2 Outbound Synchronous Request/Response

In the case of outbound synchronous request/response, a request comes from BPEL or Mediator. The Oracle Socket Adapter connects to the server socket to send the request message to the server socket on the output stream. The Oracle Socket Adapter then blocks the response from the server socket on the input stream and publishes the response back to BPEL or Mediator.

Figure 6-3 illustrates an outbound synchronous request/response scenario.

Figure 6-3 BPEL Scenario of Outbound Synchronous Request/Response

Description of Figure 6-3 follows
Description of "Figure 6-3 BPEL Scenario of Outbound Synchronous Request/Response"
6.3.1.3 Inbound Receive

As part of inbound activation, the Oracle Socket Adapter opens a server socket and waits for incoming connections. The adapter uses the connection to the server socket and reads the request message, which is published to BPEL or Mediator. In this scenario, no reply is sent.

6.3.1.4 Outbound Invoke

In the case of an outbound one way invoke scenario, the request comes from BPEL or Mediator. Oracle Socket Adapter connects to the server socket and sends the request message to the server socket on the output stream without expecting a reply.

6.3.2 Mechanisms for Defining Protocols

Communication protocols or handshakes consist of different discrete steps such as authentication procedures, acknowledgments, and sending or receiving data depending on conditions. Oracle Socket Adapter supports the following mechanisms to define the protocol handshakes.

6.3.2.1 Protocol with Handshake Mechanism Using Style Sheet

Oracle Socket Adapter can be configured to use a protocol designed with a handshake mechanism, defined using style sheets that use XPath Extension functions exposed by the adapter. This can be granular read and write operation on the socket I/O stream or till the end of the stream. These functions also enable you to use native format constructs for reading and writing data. This handshake mechanism uses XSLT constructs to define operations such as assignments, validations, and control flow.

You can use the XPath Extension functions with the translator infrastructure in the following ways:

  • By using StyleReader, which is exposed by the NXSD framework, to read and write from the socket stream using the following methods:

    • socketRead(nxsdStyle:String, nxsdStyleAttributes:String):String

      You can use this method to read from the socket input stream.

    • socketWrite(value:String, nxsdStyle:String, nxsdStyleAttributes:String):String

      You can use this method to write to the socket output stream.

    The XSLT shown in Figure 6-4 demonstrates the usage of extension functions that use StyleReader.

    Figure 6-4 XSLT with Extension Functions That Use StyleReader

    Description of Figure 6-4 follows
    Description of "Figure 6-4 XSLT with Extension Functions That Use StyleReader"
  • By annotating the schema, which defines the input and output variables, using NXSD constructs to read and write from the socket stream using the following methods:

    • socketReadWithXlation():DocumentFragment

      You can use this method to read from the socket input stream by using the schema and schema element configured for input.

    • socketWriteWithXlation(xml:NodeList)

      You can use this method to write to the socket output stream by using the schema configured for output.

    The XSD file shown in Figure 6-5 demonstrates the usage of extension functions by annotating the schema, which defines the input and output variables, using NXSD constructs.

    Figure 6-5 XSD with Extension Functions That Do Not Use StyleReader

    Description of Figure 6-5 follows
    Description of "Figure 6-5 XSD with Extension Functions That Do Not Use StyleReader"

To define a handshake using style sheet, you must select Use XSLT to define the handshake and browse to select the XSL file in the Protocol page, as shown in Figure 6-6.

Figure 6-6 Defining a Protocol with the Handshake Mechanism By Using a Style Sheet

Description of Figure 6-6 follows
Description of "Figure 6-6 Defining a Protocol with the Handshake Mechanism By Using a Style Sheet"
6.3.2.2 Protocol with Handshake Mechanism Using Custom Java Code

Oracle Socket Adapter can be configured to use a protocol with a customized handshake mechanism, defined by plugging in custom Java code. The custom Java code must implement oracle.tip.pc.services.translation.util.ICustomParser, the ICustomParser interface, provided by Oracle Socket Adapter, which enables custom implementation of handshakes.

Note:

The ICustomParser interface files are in the bpm-infra.jar file. This jar file is available in the following directory:

$SOA_ORACLE_HOME/soa/modules/oracle.soa.fabric_11.1.1

The following methods must be implemented based on the appropriate communication paradigm:

  • public Element executeOutbound(InputStream in, OutputStream out, Element payLoad) throws Exception;

    The outbound handshake must implement this method.

    Example:

    public Element executeOutbound(InputStream in, OutputStream out, Element payLoad) throws Exception {
        BufferedReader in1 = new BufferedReader(new InputStreamReader(in));
        PrintWriter out1 = new PrintWriter(new OutputStreamWriter(out));
     
        out1.println(payLoad.getFirstChild().getNodeValue());
          
        String retVal = in1.readLine();
      
        StringBuffer strBuf = new StringBuffer();
        strBuf.append("<?xml version='1.0' encoding='" + enc + "' ?>"
                + "<out xmlns='http://xmlns.oracle.com/EchoServer/'>");
            strBuf.append(retVal + "</out>");
     
        DOMParser parser = new DOMParser();
        parser.setValidationMode(DOMParser.NONVALIDATING);
            Element elem = (Element) parser.getDocument().getElementsByTagName(
                "out").item(0);
     
        return elem;
    }
    
  • public Element executeInboundRequest(InputStream in) throws Exception;

    The inbound request must implement this method.

    Example:

    public Element executeInboundRequest(InputStream in) throws Exception {
        BufferedReader in1 = new BufferedReader(new InputStreamReader(in));
     
        String input = in1.readLine();
      
        StringBuffer strBuf = new StringBuffer();
        strBuf.append("<?xml version='1.0' encoding='" + enc + "' ?>"
                + "<EchoClientProcessRequest xmlns='http://xmlns.oracle.com/EchoClient'>");
     
            strBuf.append("<input>" + input + "</input></EchoClientProcessRequest>");
     
        DOMParser parser = new DOMParser();
        parser.setValidationMode(DOMParser.NONVALIDATING);
        parser.parse(new InputSource(new StringReader(strBuf.toString())));
        Element elem = (Element) parser.getDocument().getElementsByTagName(
                "EchoClientProcessRequest").item(0);
     
        return elem;
    }
    
  • public void executeInboundReply(Element payLoad, OutputStream out) throws Exception;

    The inbound reply must implement this method.

    Example:

    public void executeInboundReply(Element payLoad, OutputStream out) throws Exception {
        PrintWriter out1 = new PrintWriter(new OutputStreamWriter(out));
       
        NodeList list = payLoad.getChildNodes();
        String retVal = null;
        for(int i = 0; i < list.getLength(); i++) {
            Node node = list.item(i);
            NodeList list1 = node.getChildNodes();
            for(int j = 0; j < list1.getLength(); j++) {
                Node node1 = list1.item(j);
                if(node1.getNodeType() == Node.TEXT_NODE) {
                        retVal = node1.getNodeValue();
                }
            }
        }
        out1.println(retVal);
        out1.flush();
    }
    

The following is a complete example. You need bpm-infra.jar and xmlparserv2.jar to compile. You can find these JARs at:

  • $SOA_ORACLE_HOME/soa/soa/modules/oracle.soa.fabric_11.1.1/bpm-infra.jar
  • $SOA_ORACLE_HOME/oracle_common/modules/oracle.xdk/xmlparserv2.jar
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringReader;

import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

import oracle.tip.pc.services.translation.util.ICustomParser;
import oracle.xml.parser.v2.DOMParser;

public class SocketAdapterCustomCode implements ICustomParser
{
String enc = "UTF-8";

public Element executeOutbound(InputStream in, OutputStream out, Element
payLoad) throws Exception {
    BufferedReader in1 = new BufferedReader(new InputStreamReader(in));
    PrintWriter out1 = new PrintWriter(new OutputStreamWriter(out));
 
    out1.println(payLoad.getFirstChild().getNodeValue());
      
    String retVal = in1.readLine();
    
    StringBuffer strBuf = new StringBuffer();
    strBuf.append("<?xml version='1.0' encoding='" + enc + "' ?>"
            + "<out xmlns='http://xmlns.oracle.com/EchoServer/'>");
        strBuf.append(retVal + "</out>");
 
    DOMParser parser = new DOMParser();
    parser.setValidationMode(DOMParser.NONVALIDATING);
        Element elem = (Element) parser.getDocument().getElementsByTagName(
            "out").item(0);
 
    return elem;
    }

public Element executeInboundRequest(InputStream in) throws Exception {
    BufferedReader in1 = new BufferedReader(new InputStreamReader(in));
 
    String input = in1.readLine();
  
    StringBuffer strBuf = new StringBuffer();
    strBuf.append("<?xml version='1.0' encoding='" + enc + "' ?>"
            + "<EchoClientProcessRequest xmlns='http://xmlns.oracle.com/EchoClient'>");
 
        strBuf.append("<input>" + input + "</input></EchoClientProcessRequest>");
 
    DOMParser parser = new DOMParser();
    parser.setValidationMode(DOMParser.NONVALIDATING);
    parser.parse(new InputSource(new StringReader(strBuf.toString())));
    Element elem = (Element) parser.getDocument().getElementsByTagName(
            "EchoClientProcessRequest").item(0);
 
    return elem;
    }

public void executeInboundReply(Element payLoad, OutputStream out) throws
Exception {
    PrintWriter out1 = new PrintWriter(new OutputStreamWriter(out));
  
    NodeList list = payLoad.getChildNodes();
    String retVal = null;
    for(int i = 0; i < list.getLength(); i++) {
        Node node = list.item(i);
        NodeList list1 = node.getChildNodes();
        for(int j = 0; j < list1.getLength(); j++) {
            Node node1 = list1.item(j);
            if(node1.getNodeType() == Node.TEXT_NODE) {
                    retVal = node1.getNodeValue();
            }
        }
    }
    out1.println(retVal);
    out1.flush();
    }
}

Note:

in is the handle to the socket input stream and out is the handle to the socket output stream.

To use a custom Java code to define a handshake, you must select Use Custom Java Code to define the handshake and specify the Java class implementing the handshake in the Java Class field, as shown in Figure 6-7.

Figure 6-7 Defining a Protocol with Handshake Mechanism By Using Custom Java Code

Description of Figure 6-7 follows
Description of "Figure 6-7 Defining a Protocol with Handshake Mechanism By Using Custom Java Code"
6.3.2.3 Protocol Without Handshake Mechanism

Oracle Socket Adapter can be configured to use protocols that do not require handshakes involving translation to and from the socket I/O stream.

To use a protocol that does not require a handshake, you must select No Handshake in the Protocol page, as shown in Figure 6-8.

Figure 6-8 Defining a Protocol without a Handshake Mechanism

Description of Figure 6-8 follows
Description of "Figure 6-8 Defining a Protocol without a Handshake Mechanism"

6.3.3 Character Encoding and Byte Order

The Encoding property represents the character encoding in which native data is stored, and the ByteOrder property is the byte order of the native data, which is either BIG_ENDIAN or LITTLE_ENDIAN.

Character encoding and byte order can be specified in the schema file (NXSD), using the Native Format Builder wizard. You can also specify the encoding and the byte order to be used, by using the Adapter Configuration Wizard. When encoding and byte order are not specified, the default values are US-ASCII and BIG_ENDIAN.

To specify the encoding and byte order values, which are applicable only if you are using translation, you must perform the following steps in the Protocol page of the Adapter Configuration Wizard:

  1. In the Encoding/ByteOrder section of the Protocol page, select the Specify Encoding/Byte Order option, as shown in Figure 6-9.

    Figure 6-9 The Adapter Configuration Wizard - Protocol Page

    Description of Figure 6-9 follows
    Description of "Figure 6-9 The Adapter Configuration Wizard - Protocol Page"
  2. Perform one of these tasks to set the encoding:

    1. To use the encoding specified in the schema file, leave Encoding unchecked.

    2. To specify the encoding using the Adapter Configuration Wizard, select Encoding, and then select an encoding type from the Encoding list.

      Note:

      If you select Encoding, then the encoding type specified using the Adapter Configuration Wizard takes precedence over the encoding type specified in the NXSD file.

  3. Perform one of these tasks to set the byte order:

    1. To use the byte order specified in the schema file, select Use Byte Order Value from the schema.

    2. To specify the byte order using the Adapter Configuration Wizard, select ByteOrder, and then select a byte order from the ByteOrder list.

  4. Click Finish. Once you click Finish, the Configuration Wizard displays a page that indicates that you have finished configuring the Socket Adapter.

6.3.4 Performance Tuning

The Oracle Socket Adapter supports performance tuning features, including:

For more information, see Oracle JCA Adapter Tuning Guide and Oracle JCA Adapter Properties.

6.3.4.1 Configuring Oracle Socket Adapter Connection Pooling

One way to optimize Oracle Socket Adapter performance is by using a Connection Pool. You can use a connection pool while the socket server you are connecting to does not close the socket with each interaction. A connection pool lets you use a socket connection repeatedly, avoiding the overhead of creating a new socket for each interaction. You must configure the connection pool for the Oracle Socket Adapter using the Oracle WebLogic Server console.

Note:

The Connection Pool feature is applicable to outbound interactions only.

6.3.4.1.1 How to Configure Oracle Socket Adapter Connection Pooling
  1. Log into your Oracle WebLogic Server console. To access the console navigate to http://servername:portnumber/console.
  2. Click Deployments in the left pane for Domain Structure. The Summary of Deployments page is displayed.

    Figure 6-10 Oracle WebLogic Server Console - Summary of Deployments Page

    Description of Figure 6-10 follows
    Description of "Figure 6-10 Oracle WebLogic Server Console - Summary of Deployments Page"
  3. Click SocketAdapter. The Settings for SocketAdapter page is displayed.
  4. Click the Configuration tab.
  5. Click the Outbound Connection Pools tab, and expand javax.resource.cci.ConnectionFactory to see the configured connection factories, as shown in Figure 6-11:

    Figure 6-11 Oracle WebLogic Server Console - Settings for SocketAdapter Page

    Description of Figure 6-11 follows
    Description of "Figure 6-11 Oracle WebLogic Server Console - Settings for SocketAdapter Page"
  6. Click eis/socket/SocketAdapter. The Settings for javax.resource.cci.ConnectionFactory page is displayed.
  7. Set the KeepAlive connection factory property to true, as shown in Figure 6-12. The connection pool feature for the Oracle Socket Adapter is enabled.

    Figure 6-12 Oracle WebLogic Server Console - Settings for javax.resource.cci.Connectionfactory Page

    Description of Figure 6-12 follows
    Description of "Figure 6-12 Oracle WebLogic Server Console - Settings for javax.resource.cci.Connectionfactory Page"
  8. Click Save. The Settings for javax.resource.cci.ConnectionFactory page is displayed with the message, Deployment plan has been successfully updated, as shown in Figure 6-13.

    Figure 6-13 Oracle WebLogic Server Console - Settings for javax.resource.cci.Connectionfactory Page

    Description of Figure 6-13 follows
    Description of "Figure 6-13 Oracle WebLogic Server Console - Settings for javax.resource.cci.Connectionfactory Page"

Note:

You can modify connection pool parameters by using the Connection Pool tab of Oracle WebLogic Server Administration Console.

While changing Connection Pool properties, do not change the default values of the following properties.
Initial capacity=0 
Max capacity=200 
Test on Create=false 
When you change Test on Create=true, the resource adapter connection to the endpoint EIS is tested. SocketAdapter sends a dummy message to make a socket connection to check the connectivity. This action leads to exception state.

6.4 Configuring Oracle Socket Adapter

Use the information in this section to configure Oracle Socket Adapter.

6.4.1 Modifying the weblogic-ra.xml File

To configure Oracle Socket Adapter, you must specify the value of the properties listed in Table 6-1 in the weblogic-ra.xml file. You can update these properties from the Oracle WebLogic Server Administration Console. For more information, see Adding an Adapter Connection Factory.

Table 6-1 Oracle Socket Adapter Configuration Properties

Property Description

Host

In case of outbound interaction, the system name on which the socket server is running, to which you want to connect. In case of inbound interaction, it is always localhost.

Port

In case of outbound interaction, it is the port number on which a socket server is running, to which an adapter connects. In case of inbound interaction, it is the port number on which the socket adapter listens for incoming connections.

Timeout

With this value set to a nonzero timeout interval, a read() call on the InputStream associated with this socket blocks for only this amount of time. If the timeout interval expires, then a java.net.SocketTimeoutException is raised though the socket is still valid. The option must be enabled before entering the blocking operation to have effect. The timeout interval must be greater than 0. A timeout interval of 0 is interpreted as an infinite timeout. The value is in milliseconds.

KeepAlive

Applicable only in case of outbound interactions. Should be set to true to use connection pool feature.

BacklogQueue

Applicable in case of inbound interactions. This value indicates the maximum queue length for incoming connection indications (a request to connect). If a connection indication arrives when the queue is full, then the connection is refused.

Note:

There is a change in behavior in which the ServerSocket is created when you upgrade from Oracle Release 11g to Release 12c. Because of this, remote clients might not able to connect to the ServerSocket when the hostname is configured as localhost. As a workaround, the localhost should be changed to hostname.

The following is a sample weblogic-ra.xml file:

<wls:connection-instance>
                <wls:description>Socket Adapter</wls:description>
                <wls:jndi-name>eis/socket/SocketAdapter</wls:jndi-name>
                <wls:connection-properties>
                    <wls:pool-params>
                        <wls:initial-capacity>0</wls:initial-capacity>
                        <wls:max-capacity>200</wls:max-capacity>
                        <wls:capacity-increment>5</wls:capacity-increment>
                        <wls:shrinking-enabled>true</wls:shrinking-enabled>
                        
<wls:shrink-frequency-seconds>60</wls:shrink-frequency-seconds>
                        
<wls:connection-creation-retry-frequency-seconds>2</wls:connection-creation-retry
-frequency-seconds>
                        
<wls:connection-reserve-timeout-seconds>5</wls:connection-reserve-timeout-seconds>
                        
<wls:match-connections-supported>true</wls:match-connections-supported>
                        <wls:use-first-available>true</wls:use-first-available>
                    </wls:pool-params>
                    
<wls:transaction-support>NoTransaction</wls:transaction-support>
                    
<wls:reauthentication-support>true</wls:reauthentication-support>
                    <wls:properties>
                        <wls:property>
                            <wls:name>Host</wls:name>
                            <wls:value>localhost</wls:value>
                        </wls:property>
                        <wls:property>
                            <wls:name>Port</wls:name>
                            <wls:value>12110</wls:value>
                        </wls:property>
                        <wls:property>
                            <wls:name>Timeout</wls:name>
                            <wls:value>10000</wls:value>
                        </wls:property>
                        <wls:property>
                            <wls:name>BacklogQueue</wls:name>
                            <wls:value>0</wls:value>
                        </wls:property>
                        <wls:property>
                            <wls:name>KeepAlive</wls:name>
                            <wls:value>True</wls:value>
                        </wls:property>
                    </wls:properties>
                    <wls:res-auth>Application</wls:res-auth>
                </wls:connection-properties>
            </wls:connection-instance>
		

Note:

To set up connection pooling, you must set the KeepAlive property to true.

6.4.2 Modeling a Handshake

A handshake may be required to negotiate a connection with a client or a server socket.

6.4.2.1 Modeling an Outbound Handshake

The outbound XSLT uses an input corresponding to the invoked message. The outbound XSLT writes to the socket output stream by using extension functions. The output is dummy for unidirectional or a response for bidirectional communication.

The following example demonstrates the modeling of a Synchronous Request/Response communication paradigm:

<xsl:stylesheet 
...
xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator" />
xmlns:request="http://www.TragetNameSpace.com/Request" >
 
  <xsl:template match="/">
 
    <!–- Write the entire content of "books" element using translator -->
    <xsl:variable name="username" select="socket:socketWriteWithXlation(.)" />
 
    <!–- Read the stream using translator -->
    <xsl:copy-of select="socket:socketReadWithXlation()" />
    
  </xsl:template>
</xsl:stylesheet>
6.4.2.2 Modeling an Inbound Handshake

The inbound XSLT uses a dummy input, reads the socket input stream through extension functions, and constructs the XML record to be published.

The following example demonstrates a handshake in which the client sends across a user identification terminated by a comma (,) and a password terminated by a semicolon (;) for validation, and then sends the message payload:

<xsl:stylesheet 
...
xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator" />
  <xsl:template match="/">
    <!-- Read the user name -->
    <xsl:variable name="username" 
select="socket:socketRead('terminated','terminatedBy=,')" />   
    <!-- Read password if user name is correct -->
    <xsl:if test="normalize-space($username)='user'">
      <xsl:variable name="password" 
select="socket:socketRead('terminated','terminatedBy=;')" />
      <!-- If password is correct proceed to read the payload using translator 
-->
      <xsl:if test="normalize-space($password)='password'">
        <!--  Send an OK -->
        <xsl:variable name="ack1" select="socket:socketWrite('001','','')" />

        <output>
<!--  Wait for the payload -->
          <xsl:copy-of select="socket:socketReadWithXlation()" />
        </output>
 
      </xsl:if>
      <!--  Send an error -->
      <xsl:else><xsl:variable name="ack2" 
select="socket:socketWrite('000','','')" /></xsl:else>
    </xsl:if>
  </xsl:template>
</xsl:stylesheet>

6.4.3 Designing an XSL File Using the XSL Mapper Tool

You can design an XSL file by using the XSL mapper tool for Oracle Socket Adapter. The following sections describe the procedure for designing XSL for different communication scenarios:

6.4.3.1 Designing XSL for Inbound Synchronous Request/Reply

This section describes the procedure for designing XSL for an inbound synchronous request/reply scenario by using the XSL mapper tool.

To perform this use case, you must first create the following file:

  • HelloWorld.xsd

Contents of HelloWorld.xsd

<schema attributeFormDefault="unqualified"
	elementFormDefault="qualified"
	targetNamespace="http://xmlns.oracle.com/HelloWorld"
	xmlns="http://www.w3.org/2001/XMLSchema">
	<element name="HelloWorldProcessRequest">
		<complexType>
			<sequence>
				<element name="input" type="string"/>
			</sequence>
		</complexType>
	</element>
	<element name="HelloWorldProcessResponse">
		<complexType>
			<sequence>
				<element name="result" type="string"/>
			</sequence>
		</complexType>
	</element>
</schema>

Copy this file to the HelloWorldComposite\xsd folder under the HelloWorldComposite project.

6.4.3.1.1 Design a SOA Composite

To design a SOA composite, perform the steps described in Designing the SOA Composite.

Note:

The steps provided in are applicable to a composite with Oracle BPEL PM. Alternatively, you can create a composite with Oracle Mediator.

6.4.3.1.2 Create an Inbound Oracle Socket Adapter

To create an inbound Oracle Socket Adapter service, perform the following steps:

  1. Drag and drop Socket Adapter from the Components Palette to the Exposed Services swim lane. The Welcome page of the Adapter Configuration Wizard is displayed.

  2. Enter the service name, HelloWorld in the Service Name field and then click Next. The Adapter Interface page is displayed.

  3. Select Define from operation and schema (specified later), and click Next. The Operation page is displayed.

  4. Select Inbound Synchronous Request/Reply as the Operation Type and then click Next. The Socket Connection page is displayed.

  5. Enter eis/socket/InboundSocketAdapter in the Socket Connection JNDI Name field, and click Next. The Messages page is displayed.

    Figure 6-14 The Adapter Configuration Wizard Socket Connection Page

    Description of Figure 6-14 follows
    Description of "Figure 6-14 The Adapter Configuration Wizard Socket Connection Page"
  6. Click Browse For Schema File that appears at the end of the URL field in the Request Message Schema box. The Type Chooser dialog is displayed.

  7. Click Project Schema Files, HelloWorld.xsd, and HelloWorldProcessRequest.

    Figure 6-15 The Type Chooser Dialog

    Description of Figure 6-15 follows
    Description of "Figure 6-15 The Type Chooser Dialog"
  8. Click OK. The URL field in the Messages page is populated with the HelloWorld.xsd file.

  9. Click Browse For Schema File that appears at the end of the URL field in the Reply Message Schema box. The Type Chooser dialog is displayed.

  10. Click Project Schema Files, HelloWorld.xsd, and HelloWorldProcessResponse.

  11. Click OK. The URL fields in the Messages page are populated with the HelloWorld.xsd files.

    Figure 6-16 The Adapter Configuration Wizard File Messages Page

    Description of Figure 6-16 follows
    Description of "Figure 6-16 The Adapter Configuration Wizard File Messages Page"
  12. Click Next. The Protocol page is displayed.

    Figure 6-17 The Adapter Configuration Wizard - Protocol Page

    Description of Figure 6-17 follows
    Description of "Figure 6-17 The Adapter Configuration Wizard - Protocol Page"
  13. Select Use XSLT to define the handshake.

  14. Click the create new xsl file icon that appears at the end of the XSLT field. The Input dialog appears.

    Figure 6-18 The input Dialog of the Protocol Page

    Description of Figure 6-18 follows
    Description of "Figure 6-18 The input Dialog of the Protocol Page"
  15. Use the default value, request.xsl and click OK.

  16. Click the create new xsl file icon that appears at the end of the ReplyXslt field. The Input dialog appears.

  17. Use the default value, reply.xsl, as the name of the XSL file, and click OK.

  18. Click Finish. The request.xsl and the reply.xsl files are created.

    Figure 6-19 shows the request.xsl page.

    Figure 6-19 The JDeveloper - request.xsl Page

    Description of Figure 6-19 follows
    Description of "Figure 6-19 The JDeveloper - request.xsl Page"

    Note:

    A dummy.xsd file appears in the left Source pane of the request.xsl page, which is used as the source for the XSL mapper tool.

    In an inbound request scenario, Oracle Socket Adapter reads native data that is received by the socket and converts it to an XML format. That is, on the source side there is no XML file. Because the XSLT mapper always requires source and target XSD files, a dummy XSD file appears in the mapper tool.

    Figure 6-20 shows the reply.xsl page.

    Figure 6-20 The JDeveloper - reply.xsl Page

    Description of Figure 6-20 follows
    Description of "Figure 6-20 The JDeveloper - reply.xsl Page"

    Note:

    A dummy.xsd file appears in the right target pane of the reply.xsl page. This dummy.xsd file is used as the target for the XSL mapper tool.

  19. Define the request part of the inbound synchronous request/reply operation as follows:

    1. In the request.xsl page, drag and drop socketRead from the Advanced Functions list of the Components Palette to the middle pane.

      Figure 6-21 The JDeveloper - request.xsl Page

      Description of Figure 6-21 follows
      Description of "Figure 6-21 The JDeveloper - request.xsl Page"
    2. Double-click the socketRead advanced function. The Edit Function - socketRead dialog appears.

    3. Enter the function parameters in the nxsdStyle and nxsdStyleAttributes fields.

      Figure 6-22 The Edit Function - socketRead Dialog

      Description of Figure 6-22 follows
      Description of "Figure 6-22 The Edit Function - socketRead Dialog"

      Note:

      The socketRead function reads from the socket input stream by using the StyleReader exposed by the NXSD framework.

    4. Click OK. The request.xsl (XSL mapper tool) page is displayed.

    5. Link the sockRead function in the middle pane to the target input node on the right pane. The request.xsl (XSL mapper tool) with the XSL mapping is displayed.

      Figure 6-23 The JDeveloper - request.xsl Page

      Description of Figure 6-23 follows
      Description of "Figure 6-23 The JDeveloper - request.xsl Page"
  20. Define the reply part of the inbound synchronous request/reply operation as follows:

    1. From the Components window list, select Advanced, and then select Advanced Functions. A list of advanced functions are displayed.

    2. In the reply.xsl page, drag and drop socketWrite from the Advanced Functions list of the Components window to the middle pane.

    3. Double-click the socketWrite advanced function. The Edit Function - socketWrite dialog appears.

    4. Enter the function parameters in the valueToWrite, nxsdStyle, and nxsdStyleAttributes fields.

      Figure 6-24 The Edit Function - socketWrite Dialog

      Description of Figure 6-24 follows
      Description of "Figure 6-24 The Edit Function - socketWrite Dialog"

      Note:

      The socketWrite function writes to the socket output stream by using the StyleReader exposed by the NXSD framework.

    5. Click OK. The reply.xsl (XSL mapper tool) page is displayed.

    6. Link the sockWrite function in the middle pane to the target input node on the right pane. The reply.xsl (XSL mapper tool) with the XSL mapping is displayed.

      Figure 6-25 The JDeveloper - reply.xsl Page

      Description of Figure 6-25 follows
      Description of "Figure 6-25 The JDeveloper - reply.xsl Page"
  21. Click File, Save All. The request.xsl and reply.xsl files for the inbound Oracle Socket Adapter are created.

6.4.3.2 Designing XSL for Outbound Synchronous Request/Reply

This section describes the procedure for designing XSL for an outbound synchronous request/reply scenario by using the XSL mapper tool.

To perform this use case, you must first create the following file:

  • HelloWorld.xsd

Contents of HelloWorld.xsd

<schema attributeFormDefault="unqualified"
	elementFormDefault="qualified"
	targetNamespace="http://xmlns.oracle.com/HelloWorld"
	xmlns="http://www.w3.org/2001/XMLSchema">
	<element name="HelloWorldProcessRequest">
		<complexType>
			<sequence>
				<element name="input" type="string"/>
			</sequence>
		</complexType>
	</element>
	<element name="HelloWorldProcessResponse">
		<complexType>
			<sequence>
				<element name="result" type="string"/>
			</sequence>
		</complexType>
	</element>
</schema>

Copy the HelloWorld.xsd file to HelloWorldComposite\xsd under the HelloWorldComposite project.

6.4.3.2.1 Design a SOA Composite

To design a SOA composite, perform the steps described in Designing the SOA Composite.

Note:

The steps provided in Designing the SOA Composite are applicable to a composite with Oracle BPEL PM. Alternatively, you can create a composite with Oracle Mediator.

6.4.3.2.2 Create an Outbound Oracle Socket Adapter

To create an outbound Oracle Socket Adapter reference, perform the following steps:

  1. Drag and drop Socket Adapter from the Components Palette to the External References swim lane. The Welcome page of the Adapter Configuration Wizard is displayed.

  2. Enter the service name, HelloWorld, in the Service Name field and then click Next. The Adapter Interface page is displayed.

  3. Select Define from operation and schema (specified later) and click Next. The Operation page is displayed.

  4. Select Outbound Synchronous Request/Reply as the Operation Type and then click Next. The Socket Connection page is displayed.

  5. Enter eis/socket/OutboundSocketAdapter in the Socket Connection JNDI Name field and click Next. The Messages page is displayed.

  6. Click Browse For Schema File that appears at the end of the URL field in the Request Message Schema box. The Type Chooser dialog is displayed.

  7. Click Project Schema Files, HelloWorld.xsd, and HelloWorldProcessRequest, as shown in Figure 6-15.

  8. Click OK. The URL field in the Messages page is populated with the HelloWorld.xsd file.

  9. Click Browse For Schema File that appears at the end of the URL field in the Reply Message Schema box. The Type Chooser dialog is displayed.

  10. Click Project Schema Files, HelloWorld.xsd, and HelloWorldProcessResponse.

  11. Click OK. The URL fields in the Messages page are populated with the HelloWorld.xsd files, as shown in Figure 6-16.

  12. Click Next. The Protocol page is displayed.

  13. Select Use XSLT to define the handshake.

  14. Click the create new xsl file icon that appears at the end of the Xslt field. The Input dialog appears.

  15. Use the default value, invoke.xsl, as the name of the XSL file and click OK.

  16. Click Finish. The invoke.xsl file appears in the XSL mapper tool.

    Figure 6-26 The JDeveloper - invoke.xsl Page

    Description of Figure 6-26 follows
    Description of "Figure 6-26 The JDeveloper - invoke.xsl Page"
  17. Right-click the HelloWorldProcessResponse element on the target side. A menu is displayed, as shown in Figure 6-27.

    Figure 6-27 The JDeveloper - invoke.xsl Page

    Description of Figure 6-27 follows
    Description of "Figure 6-27 The JDeveloper - invoke.xsl Page"
  18. Click Add Variable.... The Add Variable dialog is displayed.

    Figure 6-28 The Add Variable Dialog

    Description of Figure 6-28 follows
    Description of "Figure 6-28 The Add Variable Dialog"
  19. Enter var1 in the Local Name field, and click OK. The var1 variable is added to the target pane of the XSL mapper tool.

  20. From the Components window list, select Advanced, then select Advanced Functions. A list of advanced functions is displayed.

  21. Define the request part of the outbound synchronous request/reply operation, to write the data to the socket server, as follows:

    1. Drag and drop socketWriteWithXlation from the Advanced Functions list of the Components window to the middle pane.

      Figure 6-29 The JDeveloper - invoke.xsl Page

      Description of Figure 6-29 follows
      Description of "Figure 6-29 The JDeveloper - invoke.xsl Page"
    2. Drag the var1 node to the socketWriteWithXlation function. A link is created, as shown in Figure 6-30.

      Figure 6-30 The JDeveloper - invoke.xsl Page

      Description of Figure 6-30 follows
      Description of "Figure 6-30 The JDeveloper - invoke.xsl Page"
    3. Double-click the socketWriteWithXlation advanced function. The Edit Function - socketWriteWithXlation dialog appears.

    4. Enter a dot (.) in the NodeList field.

      Figure 6-31 The Edit Function - socketWriteWithXlation Dialog

      Description of Figure 6-31 follows
      Description of "Figure 6-31 The Edit Function - socketWriteWithXlation Dialog"

      Note:

      The socketWriteWithXlation function writes to the socket output stream using the schema configured for the output.

      The dot (.) specified in the NodeList field signifies writing the HelloWorldProcessRequest to the top level node.

    5. Click OK. A Warning dialog appears.

    6. Click Yes. The invoke.xsl page is displayed. The request part of the Synchronous Request/Reply operation is defined.

  22. Define the reply part of the outbound synchronous request/reply operation as follows:

    1. Drag and drop socketReadWithXlation from the Advanced Functions list of the Components window to the middle pane, as shown in Figure 6-32.

      Figure 6-32 The JDeveloper - invoke.xsl Page

      Description of Figure 6-32 follows
      Description of "Figure 6-32 The JDeveloper - invoke.xsl Page"
    2. From the Components window list, select General, then select XSLT Constructs. A list of XSLT constructs is displayed.

    3. Drag copy-of from the Components window to HelloWorldProcessResponse in the target pane. The Copy-of Type Dialog appears.

      Figure 6-33 The JDeveloper - invoke.xsl Page with Copy-of Type Dialog

      Description of Figure 6-33 follows
      Description of "Figure 6-33 The JDeveloper - invoke.xsl Page with Copy-of Type Dialog"
    4. Click OK. The invoke.xsl (XSL mapper tool) page is displayed with the copy-of XSLT construct added to the target pane, as shown in Figure 6-34.

      Figure 6-34 The JDeveloper - invoke.xsl Page

      Description of Figure 6-34 follows
      Description of "Figure 6-34 The JDeveloper - invoke.xsl Page"
    5. Drag the copy-of XSLT construct to the socketReadWithXlation function. A link is created, as shown in Figure 6-35.

      Figure 6-35 The JDeveloper - invoke.xsl Page

      Description of Figure 6-35 follows
      Description of "Figure 6-35 The JDeveloper - invoke.xsl Page"
  23. Click File, then select Save All. The Outbound Synchronous Request/Reply handshake is defined.

6.4.4 Specifying a TCP Port in a Configuration Plan For an Oracle Socket Adapter

To specify a TCP port in a configuration plan for an Oracle Socket Adapter, perform the following steps (where <service-name> is Service name):

  1. Add a port property to your <service-name>_tcp.jca file:
    <property name="Port" value="Port"/>
  2. Add the following code to your configuration plan XML file:
    <service_name=<XXXXXX">
     <property>
      <property name="Port">
       <replace>2222</replace>
     </property>
     <binding type'"jca"/>
    </service>
    
  3. Add the port property to your .xml file under the service element and specify a default value, in this example, 1111
    <service name="XXXXX" ui:wsdlLocation
      <interface.wsdl.interface="..."/>
      <binding.jca config="XXXX_tcp.jca"/>
        <property name="Port" type=xs:string" many="false"  
    override="may">1111</property>
    </service>

  4. Deploy your composite with the configuration plan.

When deployed, the Oracle Socket Adapter listens on port 2222, as provided in the configuration plan.

If you deploy the composite without a configuration plan or if the configuration plan does not override the Port property, then the Oracle Socket Adapter listens on the socket that the composite.xml file's default Port property specifies (in this example, port 1111).

6.4.5 Enabling Oracle Socket Adapter to Accept Multiple Requests

When a client socket sends a message in a socket connection to server socket, the socket connection closes after handling the request. However, you can enable the client socket connection open for longer time to accept multiple requests.

To enable Oracle Socket Adapter handle multiple requests, write custom translators.

Note:

This feature is available as a patch. Download the patch for this release and update your instance.
  1. Set the JCA connection property, PersistentClient in ra.xml to true. This property is set to false by default.
    <config-property> 
    <config-property-name>PersistentClient</config-property-name> 
    <config-property-type>java.lang.String</config-property-type> 
      <config-property-value>false</config-property-value> 
    </config-property>
  2. Change the JCA binding property ConcurrentInboundProcessor in composite.xml to the value of your choice. This property restricts the number of client sockets that call the BPEL process. The default value is 50 and that allows 50 concurrent socket clients to call BPEL process.
    <property name="ConcurrentInboundProcessor" type="xs:anyAtomicType" 
    many="false" override="may">50</property>
  3. Write custom translator. Given below is the custom translator sample.
    import java.io.ByteArrayInputStream; 
    import java.io.IOException; 
    import java.io.InputStream; 
    import java.io.OutputStream; 
    import java.io.StringWriter; 
    import java.util.Base64; 
     
    import javax.xml.parsers.DocumentBuilder; 
    import javax.xml.parsers.DocumentBuilderFactory; 
    import javax.xml.parsers.ParserConfigurationException; 
    import javax.xml.transform.Transformer; 
    import javax.xml.transform.TransformerException; 
    import javax.xml.transform.TransformerFactory; 
    import javax.xml.transform.dom.DOMSource; 
    import javax.xml.transform.stream.StreamResult; 
     
    import oracle.tip.pc.services.translation.util.ICustomParser; 
     
    import org.w3c.dom.Document; 
    import org.w3c.dom.Element; 
    import org.w3c.dom.Node; 
    import org.xml.sax.SAXException; 
     
    public class CustomTranslator implements ICustomParser { 
     
        public void executeInboundReply(Element arg0, OutputStream arg1) throws 
    Exception { 
            String strPayload = printDoc(arg0); 
            System.out.println("Custom Translator: Response"); 
            arg1.write(strPayload.getBytes()); 
            arg1.flush(); 
        } 
     
    public Element executeInboundRequest(InputStream inStream) throws Exception { 
           int size = 10240; 
           int eachReadCount = 0; 
           byte[] buffer = new byte[size]; 
           eachReadCount = inStream.read(buffer); 
           if (eachReadCount == -1 || eachReadCount < size) { 
                System.out.println("There is no data left in input stream read <EOS>"); 
                return null; 
                } 
           String strXml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><opaqueElement>" 
                + new String(Base64.getEncoder().encode(buffer)) + "</opaqueElement>"; 
           System.out.println("Payload is being sent to BPEL" + strXml); 
           return getDomElement(strXml); 
        } 
     
      //This is for outbound 
      public Element executeOutbound(InputStream arg0, OutputStream arg1, Element 
    arg2) throws Exception { 
        return null; 
      } 
     
      //Dom parser for give xml string and this returns XML element 
      private Element getDomElement(String strXml) throws 
    ParserConfigurationException, SAXException, IOException { 
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 
        DocumentBuilder db = dbf.newDocumentBuilder(); 
        Document doc = db.parse(new ByteArrayInputStream(strXml.getBytes())); 
        return doc.getDocumentElement(); 
      } 
     
      //Used in case of response to convert xml element to string payload 
      private String printDoc(Node node) throws TransformerException { 
        DOMSource domSource = new DOMSource(node); 
        StringWriter writer = new StringWriter(); 
        StreamResult result = new StreamResult(writer); 
        TransformerFactory tf = TransformerFactory.newInstance(); 
        Transformer transformer = tf.newTransformer(); 
        transformer.transform(domSource, result); 
        return writer.toString(); 
      } 
    } 

    Note:

    public Element executeInboundRequest (InputStream inStream) exception method in the custom translator must return null to end the socket connection after reading all the messages from the input stream.

6.4.6 Java Script Support

The Socket Adapter currently uses XSLT and a custom Java plug-in as a way of defining complex handshakes for both inbound and outbound transactions.

However, there is now an additional way to define handshakes for these transactions, through Javascript support. This feature enables you to write your own Javascripts that can be called to define simple and request-reply handshakes for both inbound and outbound transactions.

6.4.6.1 Using the Socket Adapter Configuration Wizard to Define Scripts to Use

To define handshakes for transactions, using Javascripts you have prepared:

  1. On the Protocol Screen, choose Use Javascript to Define the Handshake

    Figure 6-36 The Socket Adapter Configuration Wizard with Javascript Chosen

    Description of Figure 6-36 follows
    Description of "Figure 6-36 The Socket Adapter Configuration Wizard with Javascript Chosen"
  2. Click Finish. On the refreshed Protocol Screen, add or browse to a location where your scripts are defined. In Figure 6-37, a request and reply script are provided. The rest of the screen is for translation purposes.

    Figure 6-37 The Socket Adapter Configuration Wizard Protocol Screen with Additional Choices for Handshake Definition

    Description of Figure 6-37 follows
    Description of "Figure 6-37 The Socket Adapter Configuration Wizard Protocol Screen with Additional Choices for Handshake Definition"
  3. Click Next or Finish. You have completed configuring the Socket Adapter with Javascripts that help provide socket communication.
6.4.6.2 Reporting

Socket Adapter XSLT and Javascript use cases define a communication protocol to communicate with the client/server sockets; typically this communication does not involve much data transfer, compared to that seen in NXSD-based usecases. Because there is not much value in capturing the message size in these use cases, the message statistics are not captured when you deploy a Socket Adapter and enable the snapshots report options provided in the Fusion Middleware Control.

Note that Adapter Reports statistics are collected only for NXSD and XSD translation. These statistics are not supported for XSLT, Javascript and custom protocols.

6.4.6.3 Sample Script

The following Java Script is a sample Java Script for use with this feature.

importPackage(java.io);
importPackage(java.lang);
importPackage(javax.xml.parsers);
 
println("=====> Under Script Execution");
var inputStream = InputStreamKey;
var outputStream = OutputStreamKey;
var requestPayloadElement = RequestPayloadElementKey;
var ReplyDOMResult = ReplyDOMResultKey;
 
var isr = new InputStreamReader(inputStream);
var osw = new OutputStreamWriter(outputStream);
var br = new BufferedReader(isr);
 
println("=====> starting handshake");
 
var reply = doHandshake();
 
createDOM(reply);
 
function writeToServer(request) {
	println("=====> Under writeToServer");
	var bw = new BufferedWriter(osw);
	bw.write(request);
	bw.newLine();
	bw.flush();
}
 
function doHandshake() {
	println("=====> Under extractPayload ");
	var nodeList = requestPayloadElement.getChildNodes();
	var length = nodeList.getLength();
	println("=====> Length :" +  length);
        //var i = 0;
        var name = "";
        var empId = "";
        for(var i=0 ; i < length; i++){
            println("===> Name" + i + "=" + nodeList.item(i).getNodeName()); // +  "; Value=" + nodeList.item(i).getFirstChild().getNodeValue());
            if(nodeList.item(i).getNodeName().indexOf("Name")!= -1){
                name = nodeList.item(i).getFirstChild().getNodeValue();
            }
            else if(nodeList.item(i).getNodeName().indexOf("EmpId")!= -1){
                empId = nodeList.item(i).getFirstChild().getNodeValue();
            }
        }
	/*println("=====> name: "+ nodeList.item(0).getNodeName());
	name = nodeList.item(0).getFirstChild().getNodeValue();
	
	
	println("=====> name: "+nodeList.item(1).getNodeName());
	empId = nodeList.item(1).getFirstChild().getNodeValue();*/
	
	println("=====> name :"+name);
	println("=====> empId :"+empId);
	
        var xmlPayload = "Hello World";/*"<ns1:Inbound-Element xmlns:ns1=\"http://xmlns.oracle.com/pcbpel/demoSchema/csv\"><ns1:Name>" + name + "</ns1:Name>" +
            			"<ns1:EmpId>" + empId +"</ns1:EmpId></ns1:Inbound-Element>";*/
        println("=====> xmlPayload :"+xmlPayload);
	writeToServer(name);
	writeToServer(empId);
	osw.close();
	var code = readFromServer();
	return code;
}
 
function readFromServer() {
    println("=====> Under readFromServer ");
    var str = ""; //= br.readLine();
    var tmpStr = "";
    while (true){
    tmpStr = br.readLine();
    if(tmpStr == -1 ||  tmpStr == null)
        break;
        println("tmpStr=" + tmpStr);
        str += tmpStr;
    }
    
    println("=====> Reply from Server :"+str);
    return  str;
}
 
function createDOM(code){
	println("=====> Under createDOM "); ;
        var fRootNode = null;
        var fDocument = null;
        var fTempNode = null;
        var NAMESPACE = "http://xmlns.oracle.com/pcbpel/demoSchema/csv";
        var ROOT_NODE = "Result";
        var dbf = DocumentBuilderFactory.newInstance();
        var db = dbf.newDocumentBuilder();
        fDocument = db.newDocument();
 
        fRootNode = fDocument.createElementNS(NAMESPACE, ROOT_NODE);
        fRootNode.appendChild(fDocument.createTextNode(code));
        
        ReplyDOMResult.setNode(fRootNode);
}

6.4.7 Socket Adapter NIO Support

The current socket adapter uses the thread-per-connection approach for inbound connections. The thread-per-connection approach uses an exclusive worker thread for each connection. Within the handling loop, a worker thread waits for new incoming data, processes the request, returns the response data. This behavior results in the blocking of the thread until an interaction completes.

However, in a scenario where a high number of concurrent users are using an inbound Socket Adapter, there is a wait for a thread once the operating system/thread pool limit reached. A large number of threads have their own memory footprints, which can cause "Out Of Memory" exceptions in certain cases.

The socket adapter now uses (New I/O) NIO APIs. The APIs of NIO have been designed to provide access to the low-level I/O operations of modern operating systems

NIO APIs reduce the number of threads to user-configurable values. This enables the Socket Adapter to achieve better performance and throughput in scenarios, where the system is loaded.

Note that the Socket Adapter supports NIO APIs only for the NXSD mode of translation. The reason for not supporting this in other modes is that NIO assumes an inherent request-reply model. a scenario where a request is always followed by a reply.

In other modes of translation, a request might not always followed by a reply. For example, a scenario where a Socket Server sends a welcome message once it receives a client connection.

Or, there could be a scenario where there are multiple handshakes (multiple reads followed by writes). In such scenario, the Socket Adapter would not know whether full data for the first read has arrived or not.

The Adapter provides support for configuring the number of nio processor threads for NIO events that are processing. The default value for this property is 1.

If you want to specify a value for the property NioProcessorThreadCount other then the default value of 1, you must manually add the property NioProcessorThreadCount to the appropriate JCA file(s) . In the following example, the value for NioProcessorThreadCount is set to 2.

Example - Manually Setting the Value for the Property NioProcessorThreadCount in the jca File

<adapter-config name="inboundRequestReplyService" adapter="Socket Adapter" wsdlLocation="inboundRequestReplyService.wsdl"
				xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
  <connection-factory location="eis/socket/SocketAdapter" adapterRef=""/>
  <endpoint-activation portType="InboundRequestReply_ptt" operation="InboundRequestReply" 
     UITransmissionPrimitive="InboundRequestReply">
    <activation-spec className=
               "oracle.tip.adapter.socket.SocketActivationSpec">
      <property name="TransMode" value="NXSD"/>
      <property name="NioProcessorThreadCount" value="2"/>
    </activation-spec>
  </endpoint-activation>
</adapter-config>

If you want to use the older implementation where a thread count is created per interaction, use the following in your JCA file:

Example - Sample jca File for Specifying Thread Count per Interaction

<adapter-config name="inboundRequestReplyService"
      adapter="Socket Adapter"
                  wsdlLocation="inboundRequestReplyService.wsdl"
   				xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
     <connection-factory location="eis/socket/SocketAdapter" adapterRef=""/>
     <endpoint-activation portType="InboundRequestReply_ptt"
       operation="InboundRequestReply"
            UITransmissionPrimitive="InboundRequestReply">
      <activation-spec className=
                  "oracle.tip.adapter.socket.SocketActivationSpec">
         <property name="TransMode" value="NXSD"/>
         <property name="SupportNIO" value="false"/>
    </activation-spec>
  </endpoint-activation>
</adapter-config>

6.4.8 SSL Support for the Socket Adapter

SSL means Secure Socket Layer and is a Cryptographic Protocol that provides Communication Security over the Internet. It provides asymmetric cryptography for Key exchange and symmetric encryption for privacy, and encrypts a segment of network Connection at the Transport Layer.

The Oracle Platform Security Service Keystore Service, or OPSS Keystore Service enables you to manage keys and certificates for SSL, message security, encryption, and related tasks. You use the Keystore Service to create and maintain keystores that contain keys, certificates, and other artifacts.

If you do not provide TrustStoreName and TrustStoreStripeName when you use KSS (then Domain level Trust store, that is, system/trust, is used.)

6.4.8.1 SSL Support within the Socket Adapter

SSL Support within the Socket Adapter is required when you want to send or receive data over a Secure Socket connection. This adds a layer of security protection over the underlying network transport protocol, and includes:

  • Integrity Protection

  • Authentication

  • Confidentiality (Privacy Protection)

SSL is supported only in non NIO scenarios.

SSL is not supported in Request-Reply scenarios with NXSD mode of translation. The translator (for NXSD or for opaque payloads) looks for the end-of-stream before translating from native format to XML SSL The Socket adapter API does not support closing of streams, hence the Socket adapter with NXSD translation is not supported for request-reply usecases.

Table 6-2 provides the Socket Adapter SSL Connection Factory properties, which includes a list of the SSL Connection Factory Properties when you configure SSL in KSS (Oracle PSS) mode.

Table 6-2 SSL Connection Factory Properties when Configured in KSS Mode

Value Description

SslEnable

Specifies if Connection Factory is SSL

KeyStorePassword

Password for the key store

TrustStorePassword

Password for trust store

SslProtocol

Version of SSL protocol (SSLv3)

KeyStoreProviderName

Key store provider

KeyStoreType

Type of key store (=KSS)

KeyStoreAlgorithm

Algorithm for key manager Factory

TrustStoreProviderName

Trust store provider

TrustStoreType

Type of trust store (=KSS)

TrustStoreAlgorithm

Algorithm for key manager Factory

NeedClientAuthentication

Specifies whether the client authentication is required (Inbound).

KeyStoreStripeName

Name of the stripe within which key store is created.

KeyStoreStripeName

Name of the key store under the given stripe.

TrustStoreName

Name of the trust store under given stripe.

TrustStoreStripeName

Name of the stripe within which trust store is created.

6.5 Oracle Socket Adapter Use Cases

This section includes the following Oracle Socket Adapter use cases.

6.5.1 Oracle Socket Adapter Hello World

This use case is a simple HelloWorld use case which demonstrates the synchronous inbound request/response and synchronous outbound request/response modes of communication using Oracle Socket Adapter. The HelloWorld business process takes an input string from the Oracle Socket Adapter inbound service and publishes the message to the BPEL process.

The BPEL process invokes the Oracle Socket Adapter outbound service (a simple HelloWorld Server, which adds a prefix ?Hello? to the input string and returns it) and returns the received string using a synchronous reply.

This use case includes the following sections:

6.5.1.1 Prerequisites

To perform this use case, you must first create the following files:

  • HelloWorld.xsd

  • request.xsl

  • reply.xsl

  • invoke.xsl

Contents of HelloWorld.xsd

<schema attributeFormDefault="unqualified"
	elementFormDefault="qualified"
	targetNamespace="http://xmlns.oracle.com/HelloWorld"
	xmlns="http://www.w3.org/2001/XMLSchema">
	<element name="HelloWorldProcessRequest">
		<complexType>
			<sequence>
				<element name="input" type="string"/>
			</sequence>
		</complexType>
	</element>
	<element name="HelloWorldProcessResponse">
		<complexType>
			<sequence>
				<element name="result" type="string"/>
			</sequence>
		</complexType>
	</element>
</schema>

Contents of request.xsl

<?xml version="1.0" encoding="windows-1252" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ora="http://www.oracle.com/XSL/Transform/java/"
                xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
                xmlns="http://xmlns.oracle.com/HelloWorld">
 <!-- Root template -->
 <xsl:template match="//input">
  <!-- Input coming from the browser would look like
  GET /input=sagar; HTTP/1.1. 
  dummy variable to read the input= text -->
  <xsl:variable name="variable1"
                select="socket:socketRead('terminated', 'terminatedBy==')"/>
                
  <!-- Read the input string terminated by ;and build the input xml -->
  <HelloWorldProcessRequest>
   <input>
    <xsl:value-of select="socket:socketRead('terminated', 'terminatedBy=;')"/>
   </input>
  </HelloWorldProcessRequest>
 </xsl:template>
</xsl:stylesheet>

Contents of reply.xsl

<?xml version="1.0" encoding="windows-1252" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ora="http://www.oracle.com/XSL/Transform/java/"
                xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
                xmlns="http://xmlns.oracle.com/HelloWorld"
                xmlns:a="http://xmlns.oracle.com/HelloWorld">
    <xsl:template match="a:HelloWorldProcessResponse">
        <!-- Get the result string value into a temp variable. -->
        <xsl:variable name="temp">
            <xsl:value-of select="a:result"/>
        </xsl:variable>
        <!-- Write back the result to the socket in an HTML form -->
        <xsl:variable name="var0"
                      select="socket:socketWrite('&lt;html>', '','')"/>
        <xsl:variable name="var1"
                      select="socket:socketWrite('&lt;body>', '','')"/>
        <xsl:variable name="var2"
                      select="socket:socketWrite('&lt;h1>', '','')"/>
        <xsl:variable name="var3" select="socket:socketWrite($temp, '','')"/>
        <xsl:variable name="var4"
                      select="socket:socketWrite('&lt;/h1>', '','')"/>
        <xsl:variable name="var5"
                      select="socket:socketWrite('&lt;/body>', '','')"/>
        <xsl:variable name="var6"
                      select="socket:socketWrite('&lt;/html>', '','')"/>
        <xsl:variable name="var7" select="socket:socketEndOutput()"/>
    </xsl:template>
</xsl:stylesheet>

Contents of invoke.xsl

<?xml version="1.0" encoding="windows-1252" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ora="http://www.oracle.com/XSL/Transform/java/"
                xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
                xmlns="http://xmlns.oracle.com/HelloWorld"
                xmlns:a="http://xmlns.oracle.com/HelloWorld">
      <!-- Root template -->
      <!-- get the input value into a temp variable -->
      <xsl:template match="a:HelloWorldProcessRequest">
            <xsl:variable name="temp">
                  <xsl:value-of select="a:input"/>
            </xsl:variable>
            <!-- write the input string over the socket stream -->
            <xsl:variable name="var1"
                          select="socket:socketWrite($temp, 'terminated', 'terminatedBy=\n')"/>
            <xsl:variable name="var2"
                          select="socket:socketWrite('quit', 'terminated', 'terminatedBy=\n')"/>
            <!-- Read the output from the server on the socket stream and build the output -->
            <HelloWorldProcessResponse>
                  <result>
                        <xsl:value-of select="socket:socketRead('terminated', 'terminatedBy=;')"/>
                  </result>
            </HelloWorldProcessResponse>          
      </xsl:template>
</xsl:stylesheet>
6.5.1.2 Designing the SOA Composite

You must create a JDeveloper application to contain the SOA composite. To create an application and a project for the use case, perform the following steps:

  1. In Application Navigator of JDeveloper, click New Application. The Create Generic Application - Name your application page is displayed.
  2. Enter helloworld-socket in the Application Name field, as shown in Figure 6-38, and then click Next. The Name your project page is displayed.

    Figure 6-38 The Create SOA Application Dialog

    Description of Figure 6-38 follows
    Description of "Figure 6-38 The Create SOA Application Dialog"
  3. Click OK. The Name Your Project dialog is displayed.
  4. Enter HelloWorldComposite in the Project Name field, and then select SOA under Project Technologies and move it to the Selected box by clicking the right-arrow, as shown in Figure 6-39.

    The HelloWorld application and the HelloWorldComposite project appear in the Application Navigator.

    Figure 6-39 The Create Project Dialog

    Description of Figure 6-39 follows
    Description of "Figure 6-39 The Create Project Dialog"
  5. Click Next. The Configure SOA settings dialog appears.
  6. Select Composite With BPEL in the Composite Template box, as shown in Figure 6-40, and click Finish. The Create BPEL Process dialog is displayed.

    Figure 6-40 The Configure SOA Settings Dialog

    Description of Figure 6-40 follows
    Description of "Figure 6-40 The Configure SOA Settings Dialog"
  7. Enter HelloWorldFlow in the Name field and select Define Service Later from the Template box, as shown in Figure 6-41.

    Figure 6-41 The Create BPEL Process Dialog

    Description of Figure 6-41 follows
    Description of "Figure 6-41 The Create BPEL Process Dialog"
  8. Click OK. The HelloWorld application and the HelloWorldComposite project appear in the design area, as shown in Figure 6-42.

    Figure 6-42 The JDeveloper - composite.xml

    Description of Figure 6-42 follows
    Description of "Figure 6-42 The JDeveloper - composite.xml"
  9. Copy the HelloWorld.xsd file that you created (see Prerequisites) to the xsd directory in your project.
  10. Copy the request.xsl, reply.xsl, and invoke.xsl files that you created (see Prerequisites) to the xsl directory in your project.
6.5.1.3 Creating the Inbound Oracle Socket Adapter Service

Perform the following steps to create an inbound Oracle Socket Adapter service:

  1. Drag and drop Socket Adapter from Components to the Exposed Services swim lane. The Welcome page of the Adapter Configuration Wizard is displayed.
  2. Enter HelloWorldClient in the Service Name field.
  3. Click Next. The Adapter Interface page is displayed.
  4. Select Define from operation and schema (specified later) and click Next. The Operation page is displayed.
  5. Select Inbound Synchronous Request/Reply as the Operation Type.
  6. Click Next. The Socket Connection page is displayed.
  7. Enter eis/socket/InboundSocketAdapter in the Socket Connection JNDI Name field, and click Next. The Messages page is displayed.
  8. Click Browse For Schema File that appears at the end of the URL field in the Request Message Schema box. The Type Chooser dialog is displayed.
  9. Click Project Schema Files, HelloWorld.xsd, and HelloWorldProcessRequest.

    Figure 6-43 The Type Chooser Dialog

    Description of Figure 6-43 follows
    Description of "Figure 6-43 The Type Chooser Dialog"
  10. Click OK. The URL field in the Messages page is populated with the HelloWorld.xsd file.
  11. Click Browse For Schema File that appears at the end of the URL field in the Reply Message Schema box. The Type Chooser dialog is displayed.
  12. Click Project Schema Files, HelloWorld.xsd, and HelloWorldProcessRequest.
  13. Click OK. The URL fields in the Messages page are populated with the HelloWorld.xsd files.

    Figure 6-44 The Adapter Configuration Wizard File Messages Page

    Description of Figure 6-44 follows
    Description of "Figure 6-44 The Adapter Configuration Wizard File Messages Page"
  14. Click Next. The Protocol page is displayed.
  15. Select Use XSLT to define the handshake.
  16. Click Browse to select the XSL file that appears at the end of the Xslt field. The SOA Resource Browser dialog is displayed.
  17. Select request.xsl as the file name, and click OK. The Xslt field is populated.

    Figure 6-45 The SOA Resource Browser Dialog

    Description of Figure 6-45 follows
    Description of "Figure 6-45 The SOA Resource Browser Dialog"
  18. Click Browse to select the XSL file that appears at the end of the ReplyXslt field. The SOA Resource Browser dialog is displayed.
  19. Select reply.xsl as the file name and click OK. The Xslt field is populated.

    Figure 6-46 The Adapter Configuration Wizard Protocol Page

    Description of Figure 6-46 follows
    Description of "Figure 6-46 The Adapter Configuration Wizard Protocol Page"
  20. Click Finish. The composite.xml page appears.

    Figure 6-47 The JDeveloper - composite.xml Page

    Description of Figure 6-47 follows
    Description of "Figure 6-47 The JDeveloper - composite.xml Page"
6.5.1.4 Creating the Outbound Oracle Socket Adapter Service

Perform the following steps to create an outbound Oracle Socket Adapter service:

  1. Drag and drop Socket Adapter from the Components window to the External References swim lane. The Welcome page of the Adapter Configuration Wizard is displayed.
  2. Enter HelloWorldServer in the Service Name field.
  3. Click Next. The Adapter Interface page is displayed.
  4. Select Define from operation and schema (specified later), and click Next. The Operation page is displayed.
  5. Select Outbound Synchronous Request/Reply as the operation type.

    Figure 6-48 The Adapter Configuration Wizard Operation Type Page

    Description of Figure 6-48 follows
    Description of "Figure 6-48 The Adapter Configuration Wizard Operation Type Page"
  6. Click Next. The Socket Connection page is displayed.
  7. Enter eis/socket/OutboundSocketAdapter in the Socket Connection JNDI Name field, and click Next. The Messages page is displayed.
  8. Click Browse For Schema File that appears at the end of the URL field in the Request Message Schema box. The Type Chooser dialog is displayed.
  9. Click Project Schema Files, HelloWorld.xsd, and HelloWorldProcessRequest, as shown in Figure 6-43.
  10. Click OK. The URL field in the Messages page is populated with the HelloWorld.xsd file.
  11. Click Browse For Schema File that appears at the end of the URL field in the Reply Message Schema box. The Type Chooser dialog is displayed.
  12. Click Project Schema Files, HelloWorld.xsd, and HelloWorldProcessResponse.
  13. Click OK. The URL fields in the Messages page are populated with the HelloWorld.xsd files.
  14. Click Next. The Protocol page is displayed.
  15. Select Use XSLT to define the handshake.
  16. Click Browse to select the XSL file that appears at the end of the Xslt field. The SOA Resource Browser dialog is displayed.
  17. Select invoke.xsl as the file name, and click OK. The Xslt field is populated.

    Figure 6-49 The SOA Resource Browser Dialog

    Description of Figure 6-49 follows
    Description of "Figure 6-49 The SOA Resource Browser Dialog"
  18. Click Finish. The composite.xml page appears.

    Figure 6-50 The JDeveloper - composite.xml Page

    Description of Figure 6-50 follows
    Description of "Figure 6-50 The JDeveloper - composite.xml Page"
6.5.1.5 Wiring Services and Activities

You have to assemble or wire the three components that you have created: Inbound adapter service, BPEL process, Outbound adapter reference. Perform the following steps to wire the components:

  1. Drag the small triangle in the HelloWorldClient in the Exposed Services area to the drop zone that appears as a green triangle in the HelloWorldFlow BPEL process in the Components area.
  2. Drag the small triangle in the HelloWorldFlow BPEL process in the Components area to the drop zone that appears as a green triangle in the HelloWorldServer in the External References area.

    The JDeveloper composite.xml appears, as shown in Figure 6-51.

    Figure 6-51 The JDeveloper - composite.xml

    Description of Figure 6-51 follows
    Description of "Figure 6-51 The JDeveloper - composite.xml"
  3. Click File, Save All.
6.5.1.5.1 Add a Receive Activity
  1. Double-click HelloWorldFlow. The BPELHelloWorld.bpel page is displayed.
  2. Drag and drop a Receive activity from the Components window to the design area, as shown in Figure 6-52.

    Figure 6-52 The JDeveloper - HelloWorldFlow.bpel

    Description of Figure 6-52 follows
    Description of "Figure 6-52 The JDeveloper - HelloWorldFlow.bpel"
  3. Double-click the Receive activity. The Receive dialog is displayed.
  4. Enter ReceiveInput in the Name field, as shown in Figure 6-53.
  5. Click Browse Partner Links at the end of the Partner Link field. The Partner Link Chooser dialog is displayed.
  6. Select HelloWorldClient, as shown in Figure 6-54, and click OK.

    Figure 6-54 The Partner Link Chooser Dialog

    Description of Figure 6-54 follows
    Description of "Figure 6-54 The Partner Link Chooser Dialog"
  7. Click the Auto-Create Variable icon to the right of the Variable field in the Receive dialog, as shown in Figure 6-55. The Create Variable dialog is displayed.
  8. Select the default variable name and click OK. The Variable field is populated with the default variable name.
  9. Check Create Instance, and click OK. The JDeveloper HelloWorldFlow.bpel page appears, as shown in Figure 6-56.

    Figure 6-56 The JDeveloper - HelloWorldFlow.bpel

    Description of Figure 6-56 follows
    Description of "Figure 6-56 The JDeveloper - HelloWorldFlow.bpel"
6.5.1.5.2 Add an Invoke Activity
  1. Drag and drop an Invoke activity after the ReceiveInput activity from the Components window to the design area, as shown in Figure 6-57.

    Figure 6-57 The JDeveloper - HelloWorldFlow.bpel

    Description of Figure 6-57 follows
    Description of "Figure 6-57 The JDeveloper - HelloWorldFlow.bpel"
  2. Double-click the Invoke activity. The Invoke dialog is displayed.
  3. Enter WriteHelloWorld in the Name field, as shown in Figure 6-58.

    Figure 6-58 The JDeveloper - HelloWorldFlow.bpel

    Description of Figure 6-58 follows
    Description of "Figure 6-58 The JDeveloper - HelloWorldFlow.bpel"
  4. Click Browse Partner Links at the end of the Partner Link field. The Partner Link Chooser dialog is displayed.
  5. Select HelloWorldServer, as shown in Figure 6-59, and click OK.

    Figure 6-59 The Partner Link Chooser Dialog

    Description of Figure 6-59 follows
    Description of "Figure 6-59 The Partner Link Chooser Dialog"
  6. Click the Automatically Create Input Variable icon to the right of the Input variable field in the Invoke dialog. The Create Variable dialog is displayed.
  7. Select the default variable name and click OK. The Variable field is populated with the default variable name.
  8. Repeat the same for selecting the output variable. The Invoke dialog is displayed, as shown in Figure 6-60.
  9. Click OK. The JDeveloper HelloWorldFlow.bpel page appears, as shown in Figure 6-61.

    Figure 6-61 The JDeveloper - HelloWorldFlow.bpel

    Description of Figure 6-61 follows
    Description of "Figure 6-61 The JDeveloper - HelloWorldFlow.bpel"
6.5.1.5.3 Add a Reply Activity
  1. Drag and drop a Reply activity from the Components window to the design area, as shown in Figure 6-62.

    Figure 6-62 The JDeveloper - HelloWorldFlow.bpel

    Description of Figure 6-62 follows
    Description of "Figure 6-62 The JDeveloper - HelloWorldFlow.bpel"
  2. Double-click the Reply activity. The Reply dialog is displayed.
  3. Enter Reply in the Name field.
  4. Click Browse Partner Links at the end of the Partner Link field. The Partner Link Chooser dialog is displayed.
  5. Select HelloWorldClient, as shown in Figure 6-54, and click OK.
  6. Click the Auto-Create Variable icon to the right of the Variable field in the Reply dialog. The Create Variable dialog is displayed.
  7. Select the default variable name and click OK. The Variable field is populated with the default variable name, as shown in Figure 6-63.
  8. Click OK. The JDeveloper HelloWorldFlow.bpel page appears, as shown in Figure 6-64.

    Figure 6-64 The JDeveloper - HelloWorldFlow.bpel

    Description of Figure 6-64 follows
    Description of "Figure 6-64 The JDeveloper - HelloWorldFlow.bpel"
6.5.1.5.4 Add Assign Activities
  1. Drag and drop an Assign activity from the Components window in between the Receive and Invoke activities in the design area.
  2. Double-click the Assign activity. The Assign dialog is displayed.
  3. Click the Copy Operation tab. The Assign dialog is displayed, as shown in Figure 6-65.

    Figure 6-65 The Assign Dialog - Copy Operation Tab

    Description of Figure 6-65 follows
    Description of "Figure 6-65 The Assign Dialog - Copy Operation Tab"
  4. Select Copy Operation. The Create Copy Operation dialog is displayed.
  5. In the left pane, under the ReceiveInput_InboundRequestReply_InputVariable variable select, ns3:input.
  6. In the right pane, under the WriteHelloWorld_OutboundRequestReply_InputVariable variable select, ns3:input, as shown in Figure 6-66.

    Figure 6-66 The Create Copy Operation Dialog

    Description of Figure 6-66 follows
    Description of "Figure 6-66 The Create Copy Operation Dialog"
  7. Click OK. The Assign dialog is displayed.
  8. Click OK. The JDeveloper HelloWorldFlow.bpel page is displayed.
  9. Add another Assign activity in between the Invoke and the Reply activities.
  10. Double-click the Assign activity.
  11. Click the Copy Operation tab, and select Copy Operation.
  12. In the left pane, select ns3:result under WriteHelloWorld_OutboundRequestReply_OutputVariable.
  13. In the right pane, select ns3:result under Reply_InboundRequestReply_OutputVariable and click OK.
  14. Click OK, the JDeveloper HelloWorldFlow.bpel page is displayed, as shown in Figure 6-67.

    Figure 6-67 The JDeveloper - HelloWorldFlow.bpel

    Description of Figure 6-67 follows
    Description of "Figure 6-67 The JDeveloper - HelloWorldFlow.bpel"
  15. Click File, Save All.
6.5.1.6 Deploying with JDeveloper

You must deploy the application profile for the SOA project and the application you created in the preceding steps. To deploy the application profile using JDeveloper, perform the following steps:

  1. Create an application server connection. For more information, see Creating an Application Server Connection for Oracle JCA Adapters.
  2. Deploy the application. For more information, see Deploying Oracle JCA Adapter Applications from JDeveloper.
6.5.1.7 Monitoring Using the Oracle Fusion Middleware Control Console

You can monitor the deployed SOA composite using the Fusion Middleware Control Console. Perform the following steps:

  1. Navigate to http://servername:portnumber/em. The composite you deployed appears in the application navigator.
  2. Click the SOA composite that you deployed. The Dashboard is displayed.

    Note your Instance ID in the Recent Instances area.

  3. Click the Instances tab. The Instance IDs of the SOA composite are listed.
  4. Click the Instance ID that you noted in Step 2. The Flow Trace page is displayed.
  5. Click your BPEL process instance. The Audit Trail of the BPEL process instance is displayed.
  6. Expand a payload node to view payload details.
  7. Click the Flow tab to view the process flow. Click an activity to view the details of the activity.

6.5.2 Flight Information Display System

The flight information display system use case demonstrates the various modes of defining handshakes by using Oracle Socket Adapter.A flight information display server (FIDS) is started by an FIDS client requesting information on flight status for flights originating from a particular source, JFK, or SFO. The FIDS, in turn, invokes flight data requests for three airlines, Airline1, Airline 2, and Airline 3. The FIDS then collates the information received and replies to the FIDS client by using the HTTP protocol.

This section includes the following topics:

6.5.2.1 Prerequisites

To perform this use case, you must first create the following files:

  • Airline1.xsd

  • Airline2.xsd

  • Airline3.xsd

  • FIDS.xsd

  • request.xsl

  • reply.xsl

  • invoke.xsl

Contents of Airline1.xsd

<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
            xmlns:tns="http://xmlns.oracle.com/Airline1"
            targetNamespace="http://xmlns.oracle.com/Airline1"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified"

            nxsd:version="NXSD"
            nxsd:stream="chars"
            nxsd:encoding="ASCII"
>
  <xsd:element name="Flight-Details">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Flight" minOccurs="1" maxOccurs="unbounded">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Number" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;" />
              <xsd:element name="Schedule" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;" />
              <xsd:element name="Destination" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy=";" nxsd:quotedBy="&quot;" />
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Source" type="xsd:string" nxsd:style="fixedLength" nxsd:length="3"/>
</xsd:schema>
<!--USE-HEADER:false:-->

Contents of Airline2.xsd

<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
            xmlns:tns="http://xmlns.oracle.com/Airline2"
            targetNamespace="http://xmlns.oracle.com/Airline2"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified"
            nxsd:version="NXSD"
            nxsd:stream="chars"
            nxsd:encoding="ASCII"
>
  <xsd:element name="flight-details">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="flight" minOccurs="1" maxOccurs="unbounded">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="flight-nr" type="xsd:string" nxsd:style="fixedLength" nxsd:length="15"/>
              <xsd:element name="time" type="xsd:string" nxsd:style="fixedLength" nxsd:length="15"/>
              <xsd:element name="dest" type="xsd:string" nxsd:style="fixedLength" nxsd:length="3"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="Source" type="xsd:string" nxsd:style="fixedLength" nxsd:length="3"/>
</xsd:schema>
<!--USE-HEADER:false:-->

Contents of Airline3.xsd

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://xmlns.oracle.com/Airline3"
            targetNamespace="http://xmlns.oracle.com/Airline3"
            elementFormDefault="qualified">
  <xsd:element name="src" type="xsd:string">
    <xsd:annotation>
      <xsd:documentation>
        A sample element
      </xsd:documentation>
    </xsd:annotation>
  </xsd:element>
  <xsd:element name="airline">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="flight">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="number" type="xsd:string"/>
              <xsd:element name="schedule" type="xsd:string"/>
              <xsd:element name="destination" type="xsd:string"/>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

Contents of FIDS.xsd

<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns="http://xmlns.oracle.com/FIDS"
            targetNamespace="http://xmlns.oracle.com/FIDS"
            elementFormDefault="qualified">
  <xsd:element name="FIDSProcessRequest">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="AirlineName" type="xsd:string"
                     maxOccurs="unbounded"/>
        <xsd:element name="Source" type="xsd:string"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
  <xsd:element name="FIDSProcessReply">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="AirlineName" maxOccurs="unbounded">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="FlightDetails" maxOccurs="unbounded">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element name="Number" type="xsd:string"/>
                    <xsd:element name="Schedule" type="xsd:string"/>
                    <xsd:element name="Destination" type="xsd:string"/>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

Contents of request.xsl

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ora="http://www.oracle.com/XSL/Transform/java/"
                xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
                xmlns="http://xmlns.oracle.com/FIDS">
 <xsl:template match="//input">
  <!-- dummy variable to read the airlines= text -->
  <xsl:variable name="variable1"
                select="socket:socketRead('terminated', 'terminatedBy=?')"/>
  <FIDSProcessRequest>
   <AirlineName>
    <xsl:value-of select="socket:socketRead('terminated', 'terminatedBy=,')"/>
   </AirlineName>
   <AirlineName>
    <xsl:value-of select="socket:socketRead('terminated', 'terminatedBy=,')"/>
   </AirlineName>
   <AirlineName>
    <xsl:value-of select="socket:socketRead('terminated', 'terminatedBy=;')"/>
   </AirlineName>
   <!-- dummy variable to read the src= text -->
   <xsl:variable name="variable2"
                 select="socket:socketRead('terminated', 'terminatedBy==')"/>
   <Source>
    <xsl:value-of select="socket:socketRead('fixedLength', 'length=3')"/>
   </Source>
  </FIDSProcessRequest>
 </xsl:template>
</xsl:stylesheet>

Contents of reply.xsl

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ora="http://www.oracle.com/XSL/Transform/java/"
                xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
                xmlns:fids="http://xmlns.oracle.com/FIDS">
  <xsl:template match="//fids:FIDSProcessReply">
    <xsl:variable name="var0" select="socket:socketWrite('&lt;html>', '','')"/>
    <xsl:variable name="var1" select="socket:socketWrite('&lt;body>', '','')"/>
    <xsl:variable name="var2"
                  select="socket:socketWrite('&lt;table width=&amp;quot;50%&amp;quot;>', '','')"/>
    <xsl:variable name="var3"
                  select="socket:socketWrite('&lt;tr  bgcolor=&amp;quot;#ddc5a6&amp;quot;>', '','')"/>
    <xsl:variable name="var4" select="socket:socketWrite('&lt;td>', '','')"/>
    <xsl:variable name="varf1"
                  select="socket:socketWrite('&lt;font face=&amp;quot;arial&amp;quot;>', '','')"/>
    <xsl:variable name="varb1" select="socket:socketWrite('&lt;b>', '','')"/>
    <xsl:variable name="var5" select="socket:socketWrite('Flight Nr.', '','')"/>
    <xsl:variable name="varb2" select="socket:socketWrite('&lt;/b>', '','')"/>
    <xsl:variable name="varf2"
                  select="socket:socketWrite('&lt;/font>', '','')"/>
    <xsl:variable name="var6" select="socket:socketWrite('&lt;/td>', '','')"/>
    <xsl:variable name="var7" select="socket:socketWrite('&lt;td>', '','')"/>
    <xsl:variable name="varf3"
                  select="socket:socketWrite('&lt;font face=&amp;quot;arial&amp;quot;>', '','')"/>
    <xsl:variable name="varb3" select="socket:socketWrite('&lt;b>', '','')"/>
    <xsl:variable name="var8" select="socket:socketWrite('Schedule', '','')"/>
    <xsl:variable name="varb4" select="socket:socketWrite('&lt;/b>', '','')"/>
    <xsl:variable name="varf4"
                  select="socket:socketWrite('&lt;/font>', '','')"/>
    <xsl:variable name="var9" select="socket:socketWrite('&lt;/td>', '','')"/>
    <xsl:variable name="var22" select="socket:socketWrite('&lt;td>', '','')"/>
    <xsl:variable name="varf23"
                  select="socket:socketWrite('&lt;font face=&amp;quot;arial&amp;quot;>', '','')"/>
    <xsl:variable name="varb23" select="socket:socketWrite('&lt;b>', '','')"/>
    <xsl:variable name="var28"
                  select="socket:socketWrite('Destination', '','')"/>
    <xsl:variable name="varb24" select="socket:socketWrite('&lt;/b>', '','')"/>
    <xsl:variable name="varf24"
                  select="socket:socketWrite('&lt;/font>', '','')"/>
    <xsl:variable name="var29" select="socket:socketWrite('&lt;/td>', '','')"/>
    <xsl:variable name="var10" select="socket:socketWrite('&lt;/tr>', '','')"/>
    <xsl:for-each select="fids:AirlineName">
      <xsl:for-each select="fids:FlightDetails">
        <xsl:variable name="var11"
                      select="socket:socketWrite('&lt;tr>', '','')"/>
        <xsl:variable name="var12"
                      select="socket:socketWrite('&lt;td>', '','')"/>
        <xsl:variable name="varf5"
                      select="socket:socketWrite('&lt;font face=&amp;quot;arial&amp;quot;>', '','')"/>
        <xsl:variable name="var13"
                      select="socket:socketWrite(fids:Number, '','')"/>
        <xsl:variable name="varf6"
                      select="socket:socketWrite('&lt;/font>', '','')"/>
        <xsl:variable name="var14"
                      select="socket:socketWrite('&lt;/td>', '','')"/>
        <xsl:variable name="var15"
                      select="socket:socketWrite('&lt;td>', '','')"/>
        <xsl:variable name="varf7"
                      select="socket:socketWrite('&lt;font face=&amp;quot;arial&amp;quot;>', '','')"/>
        <xsl:variable name="var16"
                      select="socket:socketWrite(fids:Schedule, '','')"/>
        <xsl:variable name="varf8"
                      select="socket:socketWrite('&lt;/font>', '','')"/>
        <xsl:variable name="var17"
                      select="socket:socketWrite('&lt;/td>', '','')"/>
        <xsl:variable name="var30"
                      select="socket:socketWrite('&lt;td>', '','')"/>
        <xsl:variable name="varf37"
                      select="socket:socketWrite('&lt;font face=&amp;quot;arial&amp;quot;>', '','')"/>
        <xsl:variable name="var136"
                      select="socket:socketWrite(fids:Destination, '','')"/>
        <xsl:variable name="varf38"
                      select="socket:socketWrite('&lt;/font>', '','')"/>
        <xsl:variable name="var137"
                      select="socket:socketWrite('&lt;/td>', '','')"/>
        <xsl:variable name="var18"
                      select="socket:socketWrite('&lt;/tr>', '','')"/>
      </xsl:for-each>
    </xsl:for-each>
    <xsl:variable name="var19"
                  select="socket:socketWrite('&lt;/table>', '','')"/>
    <xsl:variable name="var20"
                  select="socket:socketWrite('&lt;/body>', '','')"/>
    <xsl:variable name="var21"
                  select="socket:socketWrite('&lt;/html>', '','')"/>
    <xsl:variable name="var101" select="socket:socketEndOutput()"/>
  </xsl:template>
</xsl:stylesheet>

Contents of invoke.xsl

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:ora="http://www.oracle.com/XSL/Transform/java/"
                xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
                xmlns="http://xmlns.oracle.com/Airline1"
                xmlns:request="http://xmlns.oracle.com/Airline1">
      <xsl:template match="//request:Source">
            <xsl:variable name="var1"
                          select="socket:socketWrite('    userb', '','')"/>
            <xsl:variable name="var2"
                          select="socket:socketWrite(' password', '', '')"/>
            <xsl:variable name="AirlineReply"
                          select="socket:socketRead('fixedLength', 'length=3')"/>
            <!-- Check if authentication has happened Airline Reply Code = 100 -->
            <xsl:if test="number($AirlineReply)=100">
                  <xsl:variable name="var3"
                                select="socket:socketWrite(.,'','')"/>
                  <xsl:copy-of select="socket:socketReadWithXlation()"/>
            </xsl:if>
      </xsl:template>
</xsl:stylesheet>
6.5.2.2 Designing the SOA Composite

You must create a JDeveloper application to contain the SOA composite. To create an application and a project for the use case, perform the following steps:

  1. In the Application Navigator of JDeveloper, click New Application. The Create Generic Application - Name your application page is displayed.
  2. Enter FIDSApp in the Application Name field, and then click Next. The Name Your Project page is displayed.
  3. Click OK. The Name Your Project dialog is displayed.
  4. Enter FIDSComposite in the Project Name field, and then select SOA under Project Technologies and move it to the Selected box by clicking the right-arrow.

    The FIDSApp application and the FIDSComposite project appear in the Application Navigator.

  5. Click Next. The Configure SOA Settings dialog is displayed.
  6. Select Composite With BPEL in the Composite Template box, and click Finish. The Create BPEL Process dialog is displayed.
  7. Enter BPEL_FIDS in the Name field and select Define Service Later from the Template box.
  8. Click OK. The FIDSApp application and the FIDSComposite project appear in the design area, as shown in Figure 6-68.

    Figure 6-68 The JDeveloper - composite.xml

    Description of Figure 6-68 follows
    Description of "Figure 6-68 The JDeveloper - composite.xml"
  9. Copy the Airline1.xsd, Airline2.xsd, Airline3.xsd, and FIDS.xsd files that you created (see Prerequisites) to FIDSComposite\xsd under the project FIDSComposite.
  10. Copy the invoke.xsl, request.xsl, and reply.xsl files that you created (see Prerequisites) to FIDSComposite\xsl under the project FIDSComposite.
6.5.2.3 Creating the Inbound Oracle Socket Adapter Service

Perform the following steps to create an inbound Oracle Socket Adapter service that would be used to expose the FIDSApp application:

  1. Drag and drop Socket Adapter from the Components to the Exposed Services swim lane. The Welcome page of the Adapter Configuration Wizard is displayed.
  2. Enter FIDS in the Service Name field.
  3. Click Next. The Adapter Interface page is displayed.
  4. Select Define from operation and schema (specified later), and click Next. The Operation page is displayed.
  5. Select Inbound Synchronous Request/Reply as the operation type.
  6. Click Next. The Socket Connection page is displayed.
  7. Enter eis/socket/InboundSocketAdapter in the Socket Connection JNDI Name field and then select Specify Host and Port.

    Figure 6-69 The Adapter Configuration Wizard Socket Connection Page

    Description of Figure 6-69 follows
    Description of "Figure 6-69 The Adapter Configuration Wizard Socket Connection Page"
  8. Enter 9000 in the PortNumber field and click Next. The Messages page is displayed.
  9. Click Browse For Schema File that appears at the end of the URL field in the Request Message Schema box. The Type Chooser dialog is displayed.
  10. Click Project Schema Files, FIDS.xsd, and FIDSProcessRequest.

    Figure 6-70 The Type Chooser Dialog

    Description of Figure 6-70 follows
    Description of "Figure 6-70 The Type Chooser Dialog"
  11. Click OK. The URL field in the Messages page is populated with the FIDS.xsd file.
  12. Click Browse For Schema File that appears at the end of the URL field in the Reply Message Schema box. The Type Chooser dialog is displayed.
  13. Click Project Schema Files, FIDS.xsd, and FIDSProcessReply.
  14. Click OK. The URL fields in the Messages page are populated with the FIDS.xsd files.

    Figure 6-71 The Adapter Configuration Wizard - Messages Page

    Description of Figure 6-71 follows
    Description of "Figure 6-71 The Adapter Configuration Wizard - Messages Page"
  15. Click Next. The Protocol page is displayed.
  16. Select Use XSLT to define the handshake.
  17. Click the Browse to select the XSL file icon that appears at the end of the Xslt field. The SOA Resource Browser dialog is displayed.
  18. Select request.xsl as the file name and click OK. The Xslt field is populated.
  19. Click the Browse to select the XSL file icon that appears at the end of the ReplyXslt field. The SOA Resource Browser dialog is displayed.
  20. Select reply.xsl as the file name and click OK. The Xslt field is populated.

    Figure 6-72 The Adapter Configuration Wizard - Protocol Page

    Description of Figure 6-72 follows
    Description of "Figure 6-72 The Adapter Configuration Wizard - Protocol Page"
  21. Click Finish. The composite.xml page appears.

    Figure 6-73 The JDeveloper - composite.xml Page

    Description of Figure 6-73 follows
    Description of "Figure 6-73 The JDeveloper - composite.xml Page"
6.5.2.4 Creating Outbound Oracle Socket Adapter Services

Perform the following steps to create an outbound Oracle Socket Adapter service for the Airline1 server socket:

  1. Drag and drop Socket Adapter from the Components window to the External References swim lane. The Welcome page of the Adapter Configuration Wizard is displayed.

  2. Enter Airline1 in the Service Name field.

  3. Click Next. The Adapter Interface page is displayed.

  4. Select Define from operation and schema (specified later), and click Next. The Operation page is displayed.

  5. Select Outbound Synchronous Request/Reply as the Operation Type.

  6. Click Next. The Socket Connection page is displayed.

  7. Enter eis/socket/OutboundSocketAdapter in the Socket Connection JNDI Name field, as shown in Figure 6-74, and then select Specify Host and Port.

    Figure 6-74 The Adapter Configuration Wizard - Socket Connection Page

    Description of Figure 6-74 follows
    Description of "Figure 6-74 The Adapter Configuration Wizard - Socket Connection Page"
  8. Enter the name of the system where the Airline1 socket server program must run in the HostName field and 9001 in the PortNumber field, and click Next. The Messages page is displayed.

  9. Click Browse For Schema File that appears at the end of the URL field in the Request Message Schema box. The Type Chooser dialog is displayed.

  10. Click Project Schema Files, Airline1.xsd, and Source.

  11. Click OK. The URL field in the Messages page is populated with the Airline1.xsd file.

  12. Click Browse For Schema File that appears at the end of the URL field in the Reply Message Schema box. The Type Chooser dialog is displayed.

  13. Click Project Schema Files, Airline1.xsd, and Flight-Details.

  14. Click OK. The URL fields in the Messages page are populated with the Airline1.xsd files.

    Figure 6-75 The Adapter Configuration Wizard - Messages Page

    Description of Figure 6-75 follows
    Description of "Figure 6-75 The Adapter Configuration Wizard - Messages Page"
  15. Click Next. The Protocol page is displayed.

  16. Select Use XSLT to define the handshake.

  17. Click Browse to select the XSL file that appears at the end of the Xslt field. The SOA Resource Browser dialog is displayed.

  18. Select invoke.xsl as the file name, and click OK. The Xslt field is populated.

    Figure 6-76 The SOA Resource Browser Dialog

    Description of Figure 6-76 follows
    Description of "Figure 6-76 The SOA Resource Browser Dialog"
  19. Click Finish. The composite.xml page appears.

    Figure 6-77 The JDeveloper - composite.xml Page

    Description of Figure 6-77 follows
    Description of "Figure 6-77 The JDeveloper - composite.xml Page"

Perform the following steps to create an outbound Oracle Socket Adapter service for the Airline2 server socket:

  1. Drag and drop Socket Adapter from the Components window to the External References swim lane. The Welcome page of the Adapter Configuration Wizard is displayed.

  2. Click Next. The Service Name page is displayed.

  3. Enter Airline2 in the Service Name field.

  4. Click Next. The Adapter Interface page is displayed.

  5. Select Define from operation and schema (specified later), and click Next. The Operation page is displayed.

  6. Select Outbound Synchronous Request/Reply as the operation type.

  7. Click Next. The Socket Connection page is displayed.

  8. Enter eis/socket/OutboundSocketAdapter in the Socket Connection JNDI Name field and then select Specify Host and Port.

  9. Enter the name of the system where the Airline2 socket server program must run in the HostName field and 9002 in the PortNumber field, and click Next. The Messages page is displayed.

  10. Click Browse For Schema File that appears at the end of the URL field in the Request Message Schema box. The Type Chooser dialog is displayed.

  11. Click Project Schema Files, Airline2.xsd, and Source.

  12. Click OK. The URL field in the Messages page is populated with the Airline2.xsd file.

  13. Click Browse For Schema File that appears at the end of the URL field in the Reply Message Schema box. The Type Chooser dialog is displayed.

  14. Click Project Schema Files, Airline2.xsd, and flight-details.

  15. Click OK. The URL fields in the Messages page are populated with the Airline2.xsd files.

  16. Click Next. The Protocol page is displayed.

  17. Select No Handshake.

  18. Click Finish. The composite.xml page appears.

    Figure 6-78 The JDeveloper - composite.xml Page

    Description of Figure 6-78 follows
    Description of "Figure 6-78 The JDeveloper - composite.xml Page"

Perform the following steps to create an outbound Oracle Socket Adapter service for the Airline3 server socket:

  1. Drag and drop Socket Adapter from the Components window to the External References swim lane. The Welcome page of the Adapter Configuration Wizard is displayed.
  2. Click Next. The Service Name page is displayed.
  3. Enter Airline3 in the Service Name field.
  4. Click Next. The Adapter Interface page is displayed.
  5. Select Define from operation and schema (specified later), and click Next. The Operation page is displayed.
  6. Select Outbound Synchronous Request/Reply as the operation type.
  7. Click Next. The Socket Connection page is displayed.
  8. Enter eis/socket/OutboundSocketAdapter in the Socket Connection JNDI Name field and then select Specify Host and Port.
  9. Enter the name of the system where the Airline3 socket server program must run in the HostName field and 9003 in the PortNumber field, and click Next. The Messages page is displayed.
  10. Click Browse For Schema File that appears at the end of the URL field in the Request Message Schema box. The Type Chooser dialog is displayed.
  11. Click Project Schema Files, Airline3.xsd, and src.
  12. Click OK. The URL field in the Messages page is populated with the Airline3.xsd file.
  13. Click Browse For Schema File that appears at the end of the URL field in the Reply Message Schema box. The Type Chooser dialog is displayed.
  14. Click Project Schema Files, Airline3.xsd, and airline.
  15. Click OK. The URL fields in the Messages page are populated with the Airline3.xsd files.
  16. Click Next. The Protocol page is displayed.
  17. Select Use Custom Java Code to define the handshake.
  18. Enter com.oracle.socket.fids.custom.Airline3Custom in the Java Class field.
  19. Click Finish. The composite.xml page appears.

    Figure 6-79 The JDeveloper - composite.xml Page

    Description of Figure 6-79 follows
    Description of "Figure 6-79 The JDeveloper - composite.xml Page"
6.5.2.5 Wiring Services and Activities

You have to assemble or wire the components that you have created: Inbound adapter service, BPEL process, Outbound adapter references. Perform the following steps to wire the components:

  1. Drag the small triangle in the FIDS client in the Exposed Services area to the drop zone that appears as a green triangle in the BPEL_FIDS process in the Components area.
  2. Drag the small triangle in the BPEL_FIDS process in the Components area to the drop zone that appears as a green triangle in the Airline1, Airline2, and Airline3 servers in the External References area.

    The JDeveloper composite.xml file appears, as shown in Figure 6-80.

    Figure 6-80 The JDeveloper - composite.xml

    Description of Figure 6-80 follows
    Description of "Figure 6-80 The JDeveloper - composite.xml"
  3. Click File, Save All.
6.5.2.5.1 Add a Receive Activity
  1. Double-click BPEL_FIDS. The BPELFIDS.bpel page is displayed.
  2. Drag and drop a Receive activity from the Components window to the design area.
  3. Double-click the Receive activity. The Receive dialog is displayed.
  4. Retain the default name Receive_1 in the Name field.
  5. Click Browse Partner Links at the end of the Partner Link field. The Partner Link Chooser dialog is displayed.
  6. Select FIDS, as shown in Figure 6-81, and click OK.

    Figure 6-81 The Partner Link Chooser Dialog

    Description of Figure 6-81 follows
    Description of "Figure 6-81 The Partner Link Chooser Dialog"
  7. Click the Auto-Create Variable icon to the right of the Variable field in the Receive dialog, as shown in Figure 6-82. The Create Variable dialog is displayed.
  8. Select the default variable name and click OK. The Variable field is populated with the default variable name.
  9. Check Create Instance, and click OK. The JDeveloper BPEL_FIDS.bpel page appears, as shown in Figure 6-83.

    Figure 6-83 The JDeveloper - BPEL_FIDS.bpel

    Description of Figure 6-83 follows
    Description of "Figure 6-83 The JDeveloper - BPEL_FIDS.bpel"
6.5.2.5.2 Add a Reply Activity
  1. Drag and drop an Reply activity from the Components window to the design area, as shown in Figure 6-84.

    Figure 6-84 The JDeveloper - BPEL_FIDS.bpel

    Description of Figure 6-84 follows
    Description of "Figure 6-84 The JDeveloper - BPEL_FIDS.bpel"
  2. Double-click the Reply activity. The Reply dialog is displayed.
  3. Retain the default name Reply_1 in the Name field.
  4. Click Browse Partner Links at the end of the Partner Link field. The Partner Link Chooser dialog is displayed.
  5. Select FIDS, as shown in Figure 6-81, and click OK.
  6. Click the Auto-Create Variable icon to the right of the Variable field in the Reply dialog. The Create Variable dialog is displayed.
  7. Select the default variable name and click OK. The Variable field is populated with the default variable name, as shown in Figure 6-85.
  8. Click OK. The JDeveloper BPEL_FIDS.bpel page appears, as shown in Figure 6-86.

    Figure 6-86 The JDeveloper - BPEL_FIDS.bpel

    Description of Figure 6-86 follows
    Description of "Figure 6-86 The JDeveloper - BPEL_FIDS.bpel"
6.5.2.5.3 Add a Flow Activity
  1. Drag and drop a Flow activity from the Components window in between the Receive and the Reply activities in the design area, as shown in Figure 6-87.

    Figure 6-87 The JDeveloper - BPEL_FIDS.bpel

    Description of Figure 6-87 follows
    Description of "Figure 6-87 The JDeveloper - BPEL_FIDS.bpel"
  2. Expand the Flow_1 activity. This displays a screen to create sequences.
6.5.2.5.4 Design the Flow for Airline1 Server
  1. Drag and drop a Switch activity from the Components window to Sequence_1, as shown in Figure 6-88.

    Figure 6-88 The JDeveloper - BPEL_FIDS.bpel Page

    Description of Figure 6-88 follows
    Description of "Figure 6-88 The JDeveloper - BPEL_FIDS.bpel Page"
  2. Expand the Switch activity. This displays a screen to enter the values for <case> and <otherwise>.

  3. In the <case> section, click the View Condition Expression icon, as shown in Figure 6-89. The Condition Expression pop-up window is displayed.

    Figure 6-89 The JDeveloper - BPEL_FIDS.bpel Page

    Description of Figure 6-89 follows
    Description of "Figure 6-89 The JDeveloper - BPEL_FIDS.bpel Page"
  4. Click the Xpath Expression Builder icon in the pop-up window. The Expression Builder dialog is displayed.

  5. Enter boolean(bpws:getVariableData('Receive_1_InboundRequestReply_InputVariable','FIDSProcessRequest','/ns5:FIDSProcessRequest/ns5:AirlineName')='Airline1') as the expression, as shown in Figure 6-90, and click OK.

    The screen returns to the Condition Expression pop-up window.

    Note:

    This expression ensures that this flow is executed only when information for Airline1 is requested.

    Figure 6-90 The Expression Builder Dialog

    Description of Figure 6-90 follows
    Description of "Figure 6-90 The Expression Builder Dialog"
  6. Add an Invoke activity to the <case> section.

    1. Drag and drop an Invoke activity in the <case> section.

    2. Double-click the Invoke activity. The Invoke dialog is displayed.

    3. Click Browse Partner Links at the end of the Partner Link field. The Partner Link Chooser dialog is displayed.

    4. Select Airline1, and click OK.

    5. Click the Automatically Create Input Variable and the Automatically Create Output Variable icons to the right of the Input and Output Variable fields in the Invoke dialog. The Create Variable dialogs are displayed.

    6. Select the default variable names and click OK. The Variable fields are populated with the default variable name. The Invoke dialog is displayed.

    7. Click OK. The JDeveloper BPEL_FIDS.bpel page is displayed, as shown in Figure 6-91.

    Figure 6-91 The JDeveloper - BPEL_FIDS.bpel

    Description of Figure 6-91 follows
    Description of "Figure 6-91 The JDeveloper - BPEL_FIDS.bpel"
  7. Add an assign activity to the <case> section.

    1. Drag and drop an Assign activity from the Components window before the Invoke_1 activity in the <case> section.

    2. Double-click the Assign_1 activity. The Assign dialog is displayed.

    3. Click the Copy Operation tab. The Assign dialog is displayed.

    4. Select Copy Operation. The Create Copy Operation dialog is displayed.

    5. Create the copy operation between the source from the input variable of the Receive_1 activity and the source from the input variable of the Invoke_1 activity, as shown in Figure 6-92.

      Figure 6-92 The Create Copy Operation Dialog

      Description of Figure 6-92 follows
      Description of "Figure 6-92 The Create Copy Operation Dialog"
    6. Click OK in the dialog. The Create Copy Operation dialog is displayed.

    7. Click OK.

    The BPEL_FIDS.bpel page is displayed, as shown in Figure 6-93.

    Figure 6-93 The JDeveloper - BPELFIDS.bpel

    Description of Figure 6-93 follows
    Description of "Figure 6-93 The JDeveloper - BPELFIDS.bpel"
  8. Add a Transform activity to the <case> section.

    1. Drag and drop a Transform activity in the <case> section, after the Invoke_1 activity.

    2. Double-click the Transform activity.

    3. Click the Transformation tab.

    4. Click the Create...(Alt+N) icon. The Source Variable dialog is displayed.

    5. Select Invoke_1_OutboundRequestReply_OutputVariable from the Source Variable list and click OK.

    6. Select Reply_1_InboundRequestReply_OutputVariable from the Target Variable list.

    7. Click OK. The XSL mapper tool is displayed.

    8. Link the tns:Flight node from the source, on the left pane to the target FlightDetails node on the right pane. The Auto Map Preferences dialog appears.

    9. Click OK. The Transformation_1.xsl (XSL mapper tool) is displayed, as shown in Figure 6-94.

      Figure 6-94 The JDeveloper - Transformation_1.XSL Page

      Description of Figure 6-94 follows
      Description of "Figure 6-94 The JDeveloper - Transformation_1.XSL Page"
  9. Click File, Save All. The BPEL_FIDS.bpel page is displayed, as shown in Figure 6-95, with the flow defined for the Airline1 server.

    Figure 6-95 The JDeveloper - BPEL_FIDS.bpel

    Description of Figure 6-95 follows
    Description of "Figure 6-95 The JDeveloper - BPEL_FIDS.bpel"
6.5.2.5.5 Design the Flow for Airline2 Server
  1. Double-click the empty Sequence activity and enter Sequence_2 in the Name field.

  2. Drag and drop a Switch activity from the Components window to Sequence_2.

  3. Expand the Switch activity. This displays a screen to enter the values for <case> and <otherwise>.

  4. In the <case> section, click the View Condition Expression icon. The Condition Expression pop-up window is displayed.

  5. Click the Xpath Expression Builder icon in the pop-up window. The Expression Builder dialog is displayed.

  6. Enter boolean(bpws:getVariableData('Receive_1_InboundRequestReply_InputVariable','FIDSProcessRequest','/ns5:FIDSProcessRequest/ns5:AirlineName')='Airline2') as the expression, and click OK. The screen returns to the Condition Expression pop-up window.

    Note:

    This expression ensures that this flow is executed only when information for Airline2 is requested.

  7. Add an invoke activity to the <case> section.

    1. Drag and drop an Invoke activity in the <case> section.

    2. Double-click the Invoke_2 activity. The Invoke dialog is displayed.

    3. Click Browse Partner Links at the end of the Partner Link field. The Partner Link Chooser dialog is displayed.

    4. Select Airline2, and click OK.

    5. Click the Automatically Create Input Variable and the Automatically Create Output Variable icons to the right of the Input and Output Variable fields in the Invoke dialog. The Create Variable dialogs are displayed.

    6. Select the default variable names and click OK. The Input and Output Variable fields are populated with the default variable names. The Invoke dialog is displayed.

    7. Click OK. An Invoke activity is added to the JDeveloper BPEL_FIDS.bpel page under Sequence_2.

  8. Add an assign activity to the <case> section.

    1. Drag and drop an Assign activity from the Components window before the Invoke activity in the <case> section.

    2. Double-click the Assign_2 activity. The Assign dialog is displayed.

    3. Click the Copy Operation tab. The Assign dialog is displayed.

    4. Select Copy Operation. The Create Copy Operation dialog is displayed.

    5. Create the copy operation between the source from the input variable of the Receive_1 activity and the source from the input variable of the Invoke_2 activity, as shown in Figure 6-96.

      Figure 6-96 The Create Copy Operation Dialog

      Description of Figure 6-96 follows
      Description of "Figure 6-96 The Create Copy Operation Dialog"
    6. Click OK in the Create Copy Operation dialog.

    7. Click OK.

  9. Create a temporary variable and add a Transform activity to the <case> section.

    Note:

    The temporary variable is used for storing flight details from the Airline2 server, which would later be appended to the reply variable.

    1. Click the Variables... icon represented by (x). The Variables dialog is displayed, as shown in Figure 6-97.

      Figure 6-97 The Variables Dialog

      Description of Figure 6-97 follows
      Description of "Figure 6-97 The Variables Dialog"
    2. Click the Create... icon. The Create Variable dialog is displayed, as shown in Figure 6-98.

      Figure 6-98 The Create Variable Dialog

      Description of Figure 6-98 follows
      Description of "Figure 6-98 The Create Variable Dialog"
    3. Select Message Type as the variable type.

    4. Click the Browse Message Types icon at the end of the Message Type field. The Type Chooser dialog is displayed.

    5. Click Message Types, Partner Links, FIDS, FIDS.wsdl, Message Types, and then FIDSProcessReply_msg_reply, as shown in Figure 6-99.

      Figure 6-99 The Type Chooser Dialog

      Description of Figure 6-99 follows
      Description of "Figure 6-99 The Type Chooser Dialog"
    6. Click OK. The Message type field in the Create Variable dialog is populated with the FIDSProcessReply_msg_reply partner link.

    7. Click OK. A variable, Variable_1, of type Message Type is added to the Variables list in the Variable dialog.

    8. Click OK to return to the BPEL_FIDS.bpel page.

    9. Drag and drop a Transform activity in the <case> section, after the Invoke_2 activity.

    10. Double-click the Transform_2 activity.

    11. Click the Transformation tab.

    12. Click the Create... icon. The Source Variable dialog is displayed.

    13. Select Invoke_2_OutboundRequestReply_OutputVariable from the Source Variable list and click OK.

    14. Select Variable_1 from the Target Variable list.

    15. Click OK. The XSL mapper tool is displayed.

    16. Link the tns:flight node from the source, on the left pane to the target FlightDetails node on the right pane. The Auto Map Preferences dialog appears, as shown in Figure 6-100.

      Figure 6-100 The Transformation_2.XSL Page With Auto Map Preference Dialog

      Description of Figure 6-100 follows
      Description of "Figure 6-100 The Transformation_2.XSL Page With Auto Map Preference Dialog"
    17. Click OK. The Transformation_2.xsl (XSL mapper tool) file with the XSL mapping is displayed.

  10. Click File, Save All.

    The BPEL_FIDS.bpel page is displayed, as shown in Figure 6-101, with the flow defined for the Airline2 server.

    Figure 6-101 The JDeveloper - BPEL_FIDS.bpel

    Description of Figure 6-101 follows
    Description of "Figure 6-101 The JDeveloper - BPEL_FIDS.bpel"
6.5.2.5.6 Design the Flow for Airline3 Server
  1. Right-click the Flow_1 activity. Click Add Sequence from the menu. Sequence_3 is added.

  2. Drag and drop a Switch activity from the Components window to Sequence_3.

  3. Expand the Switch activity. This displays a screen to enter the values for <case> and <otherwise>.

  4. In the <case> section, click the View Condition Expression icon. The Condition Expression pop-up window is displayed.

  5. Click the Xpath Expression Builder icon in the pop-up window. The Expression Builder dialog is displayed.

  6. Enter boolean(bpws:getVariableData('Receive_1_InboundRequestReply_InputVariable','FIDSProcessRequest','/ns5:FIDSProcessRequest/ns5:AirlineName')='Airline3') as the expression, and click OK. The screen returns to the Condition Expression pop-up window.

    Note:

    This expression ensures that this flow is executed only when information for Airline3 is requested.

  7. Add an invoke activity to the <case> section.

    1. Drag and drop an Invoke activity in the <case> section.

    2. Double-click the Invoke_3 activity. The Invoke dialog is displayed.

    3. Click Browse Partner Links at the end of the Partner Link field. The Partner Link Chooser dialog is displayed.

    4. Select Airline3, and click OK.

    5. Click the Automatically Create Input Variable and Automatically Create Output Variable icon to the right of the Input and Output Variable field in the Invoke dialog. The Create Variable dialogs are displayed.

    6. Select the default variable names and click OK. The Input and Output Variable fields are populated with the default variable names. The Invoke dialog is displayed.

    7. Click OK. An Invoke activity is added to JDeveloper BPEL_FIDS.bpel page under Sequence_3.

  8. Add an assign activity to the <case> section.

    1. Drag and drop an Assign activity from the Components window before the Invoke activity in the <case> section.

    2. Double-click the Assign_3 activity. The Assign dialog is displayed.

    3. Click the Copy Operation tab. The Assign dialog is displayed.

    4. Select Copy Operation. The Create Copy Operation dialog is displayed.

    5. Create the copy operation between the source from the input variable of the Receive_1 activity and the source from the input variable of the Invoke_3 activity, as shown in Figure 6-102.

      Figure 6-102 The Create Copy Operation Dialog

      Description of Figure 6-102 follows
      Description of "Figure 6-102 The Create Copy Operation Dialog"
    6. Click OK in the Create Copy Operation dialog.

    7. Click OK.

  9. Create a temporary variable and add a Transform activity to the <case> section.

    Note:

    The temporary variable is used for storing flight details from the Airline3 server, which would later be appended to the reply variable.

    1. Click the Variables... icon represented by (x). The Variables dialog is displayed, as shown in Figure 6-103.

      Figure 6-103 The Variables Dialog

      Description of Figure 6-103 follows
      Description of "Figure 6-103 The Variables Dialog"
    2. Click the Create... icon. The Create Variable dialog is displayed.

    3. Select Message Type as the variable type.

    4. Click the Browse Message Types icon at the end of the Message Type field. The Type Chooser dialog is displayed.

    5. Click Message Types, Partner Links, FIDS, FIDS.wsdl, Message Types, and then FIDSProcessReply_msg_reply, as shown in Figure 6-99.

    6. Click OK. The Message type field in the Create Variable dialog is populated with the FIDSProcessReply_msg_reply partner link.

    7. Click OK. A variable, Variable_2, of type Message Type is added to the Variables list in the Variable dialog.

    8. Click OK to return to the BPEL_FIDS.bpel page.

    9. Drag and drop a Transform activity in the <case> section, after the Invoke_3 activity.

    10. Double-click the Transform_3 activity.

    11. Click the Transformation tab.

    12. Click the Create... icon. The Source Variable dialog is displayed.

    13. Select Invoke_3_OutboundRequestReply_OutputVariable from the Source Variable list and click OK.

    14. Select Variable_2 from the Target Variable list.

    15. Click OK. The XSL mapper tool is displayed.

    16. Link the tns:flight node from the source, on the left pane to the target FlightDetails node on the right pane. The Auto Map Preferences dialog appears.

    17. Click OK. The Transformation_3.xsl (XSL mapper tool) file with the XSL mapping is displayed, as shown in Figure 6-104.

      Figure 6-104 The Transformation_3.XSL Page

      Description of Figure 6-104 follows
      Description of "Figure 6-104 The Transformation_3.XSL Page"
  10. Click File, Save All. The BPEL_FIDS.bpel page is displayed, as shown in Figure 6-105, with the flow defined for the Airline3 server.

    Figure 6-105 The JDeveloper - BPEL_FIDS.bpel

    Description of Figure 6-105 follows
    Description of "Figure 6-105 The JDeveloper - BPEL_FIDS.bpel"
6.5.2.5.7 Add an Assign Activity
  1. Drag and drop an Assign activity from the Components window in between the Reply and Receive activities in the design area.
  2. Double-click the Assign_4 activity. The Assign dialog is displayed.
  3. Click the Copy Operation tab. The Assign dialog is displayed, as shown in Figure 6-106.

    Figure 6-106 The Assign Dialog - Copy Operation Tab

    Description of Figure 6-106 follows
    Description of "Figure 6-106 The Assign Dialog - Copy Operation Tab"
  4. Select Append Operation. The Create Append Operation dialog is displayed.
  5. Create an append operation to append the information stored in the temporary variable, Variable_1, to the reply variable, Reply_1_InboundRequestReply_OutputVariable, as shown in Figure 6-107.

    Figure 6-107 The Create Append Operation Dialog

    Description of Figure 6-107 follows
    Description of "Figure 6-107 The Create Append Operation Dialog"
  6. Click OK. The Assign dialog is displayed.
  7. Select Append Operation. The Create Append Operation dialog is displayed.
  8. Create another append operation to append the information stored in the temporary variable, Variable_2, to the reply variable, Reply_1_InboundRequestReply_OutputVariable, as shown in Figure 6-108.

    Figure 6-108 The Create Append Operation Dialog

    Description of Figure 6-108 follows
    Description of "Figure 6-108 The Create Append Operation Dialog"
  9. Click OK. The Assign dialog is displayed.
  10. Click OK. The JDeveloper BPEL_FIDS.bpel page is displayed, as shown in Figure 6-109.

    Figure 6-109 The JDeveloper - HelloWorldFlow.bpel

    Description of Figure 6-109 follows
    Description of "Figure 6-109 The JDeveloper - HelloWorldFlow.bpel"
  11. Click File, Save All.
6.5.2.6 Deploying with JDeveloper

You must deploy the application profile for the SOA project and the application you created in the preceding steps. To deploy the application profile using JDeveloper, perform the following steps:

  1. Create an application server connection. For more information, see Creating an Application Server Connection for Oracle JCA Adapters.
  2. Deploy the application. For more information, see Deploying Oracle JCA Adapter Applications from JDeveloper.

You must run the Server and Client java programs to test the application. For more information, see the associated README file.

6.5.2.7 Monitoring Using the Oracle Fusion Middleware Control Console

You can monitor the deployed SOA composite using the Fusion Middleware Control Console. Perform the following steps:

  1. Navigate to http://servername:portnumber/em. The composite you deployed appears in the application navigator.
  2. Click the SOA composite that you deployed. The Dashboard is displayed.

    Note your Instance ID in the Recent Instances area.

  3. Click the Instances tab. The Instance IDs of the SOA composite are listed.
  4. Click the Instance ID that you noted in Step 2. The Flow Trace page is displayed.
  5. Click your BPEL process instance. The Audit Trail of the BPEL process instance is displayed.
  6. Expand a payload node to view payload details.
  7. Click the Flow tab to view the process flow. Click an activity to view the details of the activity.

6.5.3 Cluster Support for Socket Adapter

A clustered environment is an environment where more than one Managed Server runs in a single machine with a single IP address. If you try to deploy an inbound Oracle Socket Adapter in a clustered environment, one of the Managed Servers displays an error message saying the server's port is already in use.

However, the Socket Adapter provides support for the clustered environment. You can configure the Socket Adapter so it does not throw an exception in a clustered environment.

Note that only in the Vertical Cluster environment can more than one Managed Server run on a single physical machine. In a Horizontal Cluster environment, this is not the case.

Comma separated ports are required for the vertical cluster topology.

6.5.3.1 Configuring the Socket Adapter for Use in a Clustered Environment

To configure a socket adapter for use in a clustered environment, you must specify the ports that the Socket Adapter uses as a comma-separated list within the appropriate connection factory.

Once you have configured this comma-separated list of ports, the Adapter tries to start the server socket on the first port in the list.

If the Socket Adapter fails to start server socket, it tries with the next port in the list. The Socket Adapter continues to try to start sockets until it starts a server socket on any of the ports.

If the Socket Adapter cannot start server socket on any of the port specified, it throws oracle.tip.adapter.socket.SocketServerCreationException

6.5.3.1.1 Performance Optmization with Coherence

The Socket Adapter uses the Coherence layer to obtain the port from the port list. Each instance of inbound Socket Adapter on Managed Server fetches a port from the list and makes the fetched port invisible to other instances of the Socket Adapter.

If an inbound Socket Adapter successfully opens the fetched port, the Socket Adapter deletes the fetched port from the list.

Otherwise, the fetched port is visible to other instances of inbound Socket Adapter. The other instances of inbound Socket Adapter on the Managed Server do not attempt to open the same port from the list.

6.5.3.1.2 Updating the Port Property of the JNDI Connection Factory to Enable Socket Adapter Support in a Clustered Environment

To enable Socket Adapter support in a clustered environment, you must specify the list of ports for an inbound Socket Adapter. To specify the list, you must open the WebLogic Console and to update the Port property of the JNDI connection factory with comma-separated values of ports as shown in Figure 6-110.

Figure 6-110 Specifying the List of Inbound Ports for the Inbound Socket Adapter

Description of Figure 6-110 follows
Description of "Figure 6-110 Specifying the List of Inbound Ports for the Inbound Socket Adapter"