Modifying the weblogic-ra.xml File

Oracle JCA Adapter for Sockets 5-17 The following is a sample weblogic-ra.xml file: wls:connection-instance wls:descriptionSocket Adapterwls:description wls:jndi-nameeissocketSocketAdapterwls:jndi-name wls:connection-properties wls:pool-params wls:initial-capacity0wls:initial-capacity wls:max-capacity200wls:max-capacity wls:capacity-increment5wls:capacity-increment wls:shrinking-enabledtruewls:shrinking-enabled wls:shrink-frequency-seconds60wls:shrink-frequency-seconds wls:connection-creation-retry-frequency-seconds2wls:connection-creation-retry- frequency-seconds wls:connection-reserve-timeout-seconds5wls:connection-reserve-timeout-seconds wls:match-connections-supportedtruewls:match-connections-supported wls:use-first-availabletruewls:use-first-available wls:pool-params wls:transaction-supportNoTransactionwls:transaction-support wls:reauthentication-supporttruewls:reauthentication-support wls:properties wls:property wls:nameHostwls:name wls:valuelocalhostwls:value wls:property wls:property wls:namePortwls:name wls:value12110wls:value wls:property wls:property wls:nameTimeoutwls:name Table 5–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. 5-18 Oracle Fusion Middleware Users Guide for Technology Adapters wls:value10000wls:value wls:property wls:property wls:nameBacklogQueuewls:name wls:value0wls:value wls:property wls:property wls:nameKeepAlivewls:name wls:valueTruewls:value wls:property wls:properties wls:res-authApplicationwls:res-auth wls:connection-properties wls:connection-instance

5.4.2 Modeling a Handshake

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

5.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 RequestResponse communication paradigm: xsl:stylesheet ... xmlns:socket=http:www.oracle.comXSLTransformjavaoracle.tip.adapter.socket.P rotocolTranslator xmlns:request=http:www.TragetNameSpace.comRequest 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

5.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 Note: To set up connection pooling, you must set the KeepAlive property to true. Oracle JCA Adapter for Sockets 5-19 ... xmlns:socket=http:www.oracle.comXSLTransformjavaoracle.tip.adapter.socket.P rotocolTranslator xsl:template match= -- Read the user name -- xsl:variable name=username select=socket:socketReadterminated,terminatedBy=, -- Read password if user name is correct -- xsl:if test=normalize-spaceusername=user xsl:variable name=password select=socket:socketReadterminated,terminatedBy=; -- If password is correct proceed to read the payload using translator -- xsl:if test=normalize-spacepassword=password -- Send an OK -- xsl:variable name=ack1 select=socket:socketWrite001,, output -- Wait for the payload -- xsl:copy-of select=socket:socketReadWithXlation output xsl:if -- Send an error -- xsl:elsexsl:variable name=ack2 select=socket:socketWrite000,, xsl:else xsl:if xsl:template xsl:stylesheet

5.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: ■ Section 5.4.3.1, Designing XSL for Inbound Synchronous RequestReply ■ Section 5.4.3.2, Designing XSL for Outbound Synchronous RequestReply

5.4.3.1 Designing XSL for Inbound Synchronous RequestReply

This section describes the procedure for designing XSL for an inbound synchronous requestreply scenario by using the XSL mapper tool: Note: To perform this use case, you require the following files from the artifacts.zip file contained in the Adapters-101SocketAdapterHelloWorld sample: ■ artifactsschemasHelloWorld.xsd You can access the Adapters-101SocketAdapterHelloWorld sample on the Oracle SOA Sample Code site. Copy this file to the HelloWorldComposite\xsd folder under the HelloWorldComposite project.