Protocol with Handshake Mechanism Using Style Sheet

Oracle JCA Adapter for Sockets 5-7 Figure 5–6 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. – socketWriteWithXlationxml: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 5–7 demonstrates the usage of extension functions by annotating the schema, which defines the input and output variables, using NXSD constructs. 5-8 Oracle Fusion Middleware Users Guide for Technology Adapters Figure 5–7 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 5–8 . Figure 5–8 Defining a Protocol with Handshake Mechanism By Using a Style Sheet

5.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. 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