Protocol with Handshake Mechanism Using Custom Java Code

Oracle JCA Adapter for Sockets 5-9 The following methods must be implemented based on the appropriate communication paradigm: ■ public Element executeOutboundInputStream in, OutputStream out, Element payLoad throws Exception; The outbound handshake must implement this method. Example: public Element executeOutboundInputStream in, OutputStream out, Element payLoad throws Exception { BufferedReader in1 = new BufferedReadernew InputStreamReaderin; PrintWriter out1 = new PrintWriternew OutputStreamWriterout; out1.printlnpayLoad.getFirstChild.getNodeValue; String retVal = in1.readLine; StringBuffer strBuf = new StringBuffer; strBuf.append?xml version=1.0 encoding= + enc + ? + out xmlns=http:xmlns.oracle.comEchoServer; strBuf.appendretVal + out; DOMParser parser = new DOMParser; parser.setValidationModeDOMParser.NONVALIDATING; Element elem = Element parser.getDocument.getElementsByTagName out.item0; return elem; } ■ public Element executeInboundRequestInputStream in throws Exception; The inbound request must implement this method. Example: public Element executeInboundRequestInputStream in throws Exception { BufferedReader in1 = new BufferedReadernew InputStreamReaderin; String input = in1.readLine; StringBuffer strBuf = new StringBuffer; strBuf.append?xml version=1.0 encoding= + enc + ? + EchoClientProcessRequest xmlns=http:xmlns.oracle.comEchoClient; strBuf.appendinput + input + inputEchoClientProcessRequest; DOMParser parser = new DOMParser; parser.setValidationModeDOMParser.NONVALIDATING; parser.parsenew InputSourcenew StringReaderstrBuf.toString; Note: The ICustomParser interface files are in the bpm-infra.jar file. This jar file is available in the following directory: SOA_ORACLE_HOMEsoamodulesoracle.soa.fabric_ 11.1.1 5-10 Oracle Fusion Middleware Users Guide for Technology Adapters Element elem = Element parser.getDocument.getElementsByTagName EchoClientProcessRequest.item0; return elem; } ■ public void executeInboundReplyElement payLoad, OutputStream out throws Exception; The inbound reply must implement this method. Example: public void executeInboundReplyElement payLoad, OutputStream out throws Exception { PrintWriter out1 = new PrintWriternew OutputStreamWriterout; NodeList list = payLoad.getChildNodes; String retVal = null; forint i = 0; i list.getLength; i++ { Node node = list.itemi; NodeList list1 = node.getChildNodes; forint j = 0; j list1.getLength; j++ { Node node1 = list1.itemj; ifnode1.getNodeType == Node.TEXT_NODE { retVal = node1.getNodeValue; } } } out1.printlnretVal; out1.flush; } 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 5–9 . Note: in is the handle to the socket input stream and out is the handle to the socket output stream. Oracle JCA Adapter for Sockets 5-11 Figure 5–9 Defining a Protocol with Handshake Mechanism By Using Custom Java Code

5.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 IO stream. To use a protocol that does not require a handshake, you must select No Handshake in the Protocol page, as shown in Figure 5–10 . Figure 5–10 Defining a Protocol without a Handshake Mechanism

5.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 5-12 Oracle Fusion Middleware Users Guide for Technology Adapters 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 EncodingByteOrder section of the Protocol page, select the Specify

EncodingByte Order option, as shown in Figure 5–11 . Figure 5–11 The Adapter Configuration Wizard - Protocol Page 2. Perform one of the following tasks to set the encoding:

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

b. To specify the encoding using the Adapter Configuration Wizard, select Encoding , and then select an encoding type from the Encoding list. 3. Perform one of the following tasks to set the byte order:

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

from the schema . b. 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.

5.3.4 Performance Tuning

The Oracle Socket Adapter supports performance tuning features, including: ■ Section 5.3.4.1, Configuring Oracle Socket Adapter Connection Pooling 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.