Saturday, August 16, 2014

Invoking one way https webservice from OSB/Weblogic

       We may need to configure Weblogic for invoking one way https webservice from Weblogic/OSB. It is very easy to do that.

The following are the procedures required for the same.

1. keytool -import -file <<TrustFileStore.crt>> -keystore      /software/bea/Middleware/osb/11.1.1.7/wlserver_10.3/server/lib/DemoTrust.jks  
            
*(password – DemoTrustKeyStorePassPhrase)

2. set this propety in setDomainEnv.sh
-Dweblogic.security.SSL.enable.renegotiation=true

3. Restart the managed servers.

4. Create one business service to invoke the https service.

Regards,
Sajeev

Friday, December 28, 2012

Oracle Service Bus (OSB) Performance Tuning tips

          Once you are comfortable with developing and deploying applications in OSB, the next thing that comes for you will be how fast you can run your applications and what are the standard procedures that need to be followed up in order to achieve that. 

          Based on my experience, I have come up with few points which will help you fine tune your applications and get good response times. The fine tuning of any application should start from the design phase. The design can be high level design, deployment design, low level design and finally the standard way of implementing these things.

High level design
  One should follow the most suitable and efficient design pattern in-order to achieve good result. Considering different solutions for the same problem will be handy.

Deployment design & Server Configuration
  OSB applications runs on Weblogic Server, a J2EE application server. So you should be very careful while selecting the JVM parameters like heap memory, gc algorithm, nursery size and other Java options. 
  Deep level analysis need to be done in order to understand whether the application that you are building is CPU intensive or memory intensive.

Low level design
  This is nothing but the proper work flow pattern design. You should analyse which work flow pattern will be more efficient in terms of number of threads it creates, the memory utilization and CPU utilization. Also how much of static data need to be handled and how it should be cached and so on.

Best practices for developing highly efficient OSB applications.

1. Cache the static data that need to be configured in your application. You need to consider the below points
    a. how much of data need to be cached
    b. Which caching api to use.
    
         There are two popular caching api's available - Java Caching System (JCS) and Oracle Coherence caching which Oracle recommends.


 Java Caching System (JCS)

       This is a simple caching scheme where the static data will be cached per server. This can be easily integrated to OSB application and the complexity is very less. But this is not suitable for caching very large amount of data. The caching mechanism may fail under heavy load and the cached data over 50 rows from a table.

Oracle Coherence Caching
       This is the Oracle recommended caching mechanism. We need to configure the coherence cluster in the Weblogic server level in order to use this. This is very robust and stable cache mechanism which can handle heavy load and large amount of data. The cached data will be available through out the cluster. There are different methods available for clearing the Coherence cache.

2. Disable all tracing
    For high end performance , you need to disable all kinds of tracing. This can be easily done in sbconsole.
  sbconsole -> smart search
  If you are using coherence caching, make sure that you enable caching for the business   service used for that.

3. Datasources
   If you are using datasouce for select or query operations, then use non-XA driver. 

4.  XQuery tuning

  a. Avoid using '//' anywhere in the xquery
  b. use indexes for faster xquery parsing.
  c. Use FLOWR expressions instead of 'if' conditions for checking the existence of any tag.
  d. If you want to use any intermediate xpath continuously , then assign that to a variable         
      and use it rather than querying it multiple times.
  e. Using indexes for xqueries, if you are not sure that it will return multiple rows
  f. If you use multiple 'let' statements, group it under one 'let'
  g. Avoid declaring the namespaces above xquery, it will lead to different namespace
     prefixes during runtime. Instead put it inline with xquery xml tags.
  h. Avoid using of '*' to the maximum extend
  i. Split large sized dbquery xmls to multiple parts so that xquery parsing will be easy.
        Design the dbentries in such a way that you would be easily able to split with  
        respect to some parameters.
  j. Reduce the number of parameters passing to the XQuery. Instead you can pass a single
      xml which will have all the parameters mapped



Xquery Performance testing guidelines

1. Test with huge payloads
2. Testing with values inside payload in different order (better reverse the order in the payload and test) 

For any queries , please drop a mail to
sajurrk@gmail.com or saju_rrk@yahoo.com












   
    






Sunday, March 25, 2012

Attachment Handling using Oracle Service Bus (OSB)

1. Introduction

                             Oracle Fusion 11g is an enterprise ready family of integration products from Oracle.  Oracle Service Bus (OSB) 11g  is one of the components in Fusion middleware product.  OSB can do routing, transformation and orchestration of messages. Messages can be of xml or non xml.  Here we are concerned about sending files as attachments along with the messages.  We will discuss how OSB handles attachments and the configurations done for the same and the results of one sample performance testing done in virtual data center (VDC) Linux environment.


2. Introduction to Attachment handling

            You might be remembering that in your company if you face any issues in your system, you might be asked to upload any screenshot of the problem or any documents relevant to that. Did you ever think that how these files are processed in the background.
If you analyse closely, the files you upload will be first taken by some front end application and it will be passed on to the integration middleware component and there it will be uploaded into some file server or vendor specific share point.
            In this document, we are concerned only about the integration middleware component, OSB 11g and how it handles attachment.

3. Types of Attachment handling


            Attachment handling can be of two types.
a.       Inline attachment handling
b.      MIME attachment handling

a.       Inline attachment handling
Here the attachment file will be encoded into some format, say base64 format and send it as part of the main xml message

b.      MIME attachment handling
Here the attachment will be send as part of attachment headers along wth the normal xml message. The attachments can be received in multiple formats by OSB, but one of the common format is base64 encoded binary format.

4. Configuring OSB 11g for inline attachment handling

     Open OSB eclipse and create one Oracle Service bus project.




Create one proxy service inside AttachmentHandlingTest OSB project




Go to the message handling tab and select the following
a.       XOP/MTOM
b.       page attachments to disk




Now go to the MessageFlow tab and add some pipeline pair.




Deploy the application to the server





Testing the application.

Request document to test. The attachment (embedded in the attachment tag)  is encoded as base64.

<createSRRequest>
    <request>
      <messageId>test</messageId>
     <attachment>
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAAUAAAAAAAAAAAEAAAUgAAAAEAAAD+////AAAAAE8AAAD///AUAA
     </attachment>
    </request>
</createSRRequest>









5.Configuring OSB 11g for MIME attachment handling

  
    MIME attachments are the attachments send as headers. Here the client used for posting is soapUI. We should not use the sbconsole test window to test MIME attachment applications.

If we post via soapUI, OSB receives it as binary and we can see only some java reference for this object. Inorder to access this attachment there are  two ways.

1. Using Proxy service
2. Using Java code


1. Using Proxy Service - 

    Here you will receive the headers in the $attachments variable and there you can see the attachment as header. Now create a proxy service which takes request as binary and response as text and pass the attachment binary reference to this proxy service and get back the response as text.

Please find below the screenshots.

This is the sample proxy service


Assigning the binary-content from the $attachments variable for passing it to the proxy which converts binary to text



This is the proxy which converts binary to text. See the configuration in the "Messaging" tab.


In the binary to text proxy. we will give only empty proxy. See below



Calling the converter proxy from the main proxy. The text output will be saved in the response variable as shown below


Testing Using SOAPUI


  We have to post the MIME attachment using some 3rd party tool like SOAPUI. You require one wsdl for this.There are options to add attachments with different properties. Please find below the screenshot for the same.


2. Using Java Code - <<will update soon>>


For any queries , please drop a mail to
sajurrk@gmail.com or saju_rrk@yahoo.com


Saturday, July 9, 2011

Weblogic JMS Basics

Slide 28
l
Introduction 
    The Java Messaging Service (JMS) is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients. To use JMS, we should have a JMS provider that can manage the sessions and queues. In OSB, weblogic server is the JMS provider.
Definitions
JMS Provider - An implementation of the JMS interface for a Message Oriented Middleware (MOM)
JMS Client - An application / process which can either produce or consume messages
JMS Message - The data which is transferred between JMS clients
JMS Queue - A space where the messages will be saved for sending or receiving. It will be either saved in the  Filestore or JDBC store.

JMS Topic - A mechanism for delivering messages to multiple subscribers.
JMS Point-to-Point model - Here the sender posts messages to the receiver queue.
JMS Publish/Subscribe Model - Here the message will be posted to multiple subscribers. We use 'topic' rather that 'queue' here.
JMS Server – To host different set of modules and any associated persistent storage that reside on a weblogic server instance. 
lJMS Modules – Contains configuration resources like queues, topics and connection factories 
lConnectionFactory – encapsulates connection configuration information , and enables JMS applications to create a connection 
lJNDI (Java Naming and Directory Interface) – resource lookup of JMS resources like connection factories and destinations (queues or topics) which are configured with a JNDI name. 
lWeblogic persistent storage – To store persistent message data.
     Eg : Filestore or JDBC-accessible. 

Logical diagram

JMS API architecture diagram


How to create a distributed JMS Queue

 I have seen a very good topic for this. Go through the below link

How to create a distributed JMS Queue

Thanks
Sajeev


Friday, July 8, 2011

Getting Started - XQuery Dev inside OSB Eclipse

Prerequisite
  • Should have installed OSB 
  • Basics understanding of middleware technology.
 Introduction
       We can use XQuery/XSL in OSB to do the message transformation. But XQuery is preferred over the XSL because of the  performance advantage. In this post I will show how to develop an xquery using the osb workshop eclipse.

XQuery - Introduction
       XQuery is a light weight language which has got an xml like syntax. XQuery has 3 important parts as below
  1. Namespace declaration
  2. Set of function with their implementations
  3. Declaration of variables
  4. Mentioning the function with which the execution begins.
          For further understanding of the XQuery you can refer
http://www.w3schools.com/xquery/xquery_intro.asp

Sample XQuery

Listing-1    xquery version "1.0" encoding "Cp1252";
Listing-2    (:: pragma  parameter="$anyType1" type="xs:anyType" ::)
Listing-3    (:: pragma  type="xs:anyType" ::)
Listing-4    declare namespace xf = "http://tempuri.org/OSB%20Project%203/sample/";
Listing-5    declare namespace ns1 = "http://tempuri.org/OSB%20Project%203/sample/inputaddress";
Listing-6    declare namespace ns2 = "http://tempuri.org/OSB%20Project%203/sample/outputaddress";
Listing-7
Listing-8    declare function xf:sample($requestDoc as element(*))
Listing-9                    as element(*)
Listing-10    {
Listing-11                <ns2:Address>
Listing-12                  <ns2:name>
Listing-13                  {
Listing-14                  $requestDoc/ns1:FirstName/text()
Listing-15                  }
Listing-16                  </ns2:name>
Listing-17                  <ns2:phone>
Listing-18                  {
Listing-19                  $requestDoc/ns1:PhoneNumber/text()
Listing-20                  }
Listing-21                  </ns2:phone>
Listing-22                </ns2:Address>
Listing-23    };
Listing-24
Listing-25    declare variable $requestDoc as element(*) external;
Listing-26
Listing-27    xf:sample($requestDoc)

Explanation

Listing 1 - declaration of xquery
Listing 2 to 3 - comments
Listing 4 to 6 - Namespace declarations
Listing 8 to 9
     This is the code snippet for the function 'sample' which takes 'requestDoc' which is of type element(*),             that is the xml. It returns the type element(*) which is also an xml.

Listing 10 - shows the start of the xquery function
Listing 23 - shows the end of the xquery function
Listing 11 to 22 - the body of the function 'sample'
 Here we are doing the transformation.  What ever we write it in these lines will be the final output of the 
 xquery tranformation
Listing 14 or 19 - Here we are assigning the data obtained from request xml to the output response xml.

Listing 25 - declaring the request variable 'requestDoc' as 'external' as type 'element(*)'. So when we test this xquery from the OSB flow, we will bind the request xml with 'requestDoc' variable and we can transform the request xml to the response xml. 

Listing 27 - This is the last line of the xquery where the execution of the xquery begins. Suppose if we have multiple functions, what ever function is given in the last line of xquery will be the entry point of execution.

Development of XQuery in OSB Workshop - Eclipse
          Open the eclipse and create a project . Right click on the project and create a new xquery

Give some name


Now give the request binding variables.
Here I have added only one variable.
Give the 'Parameter Name' as 'requestDoc'  and click on 'Add' so that we can add the request binding variable.


Similarly mention the response also


Now we have created the xquery. It will be now opened in the osb eclipse editor. The editor has 3 parts.
  1. Design
  2. Source
  3. Test
We can use 'Design' part if we have the source and destination schemas.

Now click on 'Source' and you can see the xquery source code.


Now modify the xquery as below

xquery version "1.0" encoding "Cp1252";
(:: pragma  parameter="$anyType1" type="xs:anyType" ::)
(:: pragma  type="xs:anyType" ::)
declare namespace xf = "http://tempuri.org/OSB%20Project%203/sample/";
declare namespace ns1 = "http://tempuri.org/OSB%20Project%203/sample/inputaddress";
declare namespace ns2 = "http://tempuri.org/OSB%20Project%203/sample/outputaddress";
declare function xf:sample($requestDoc as element(*))
    as element(*)
     {
        <ns2:Address>
          <ns2:name>
          {
          $requestDoc/ns1:FirstName/text()
          }
          </ns2:name>
          <ns2:phone>
          {
          $requestDoc/ns1:PhoneNumber/text()
          }
          </ns2:phone>
        </ns2:Address>
};
declare variable $requestDoc as element(*) external;
xf:sample($requestDoc)


Sample request xml for Testing


<ns1:AddressDetails xmlns:ns1="http://tempuri.org/OSB%20Project%203/sample/inputaddress">
 <ns1:FirstName>Sajeev</ns1:FirstName>
 <ns1:PhoneNumber>09962551082</ns1:PhoneNumber>
</ns1:AddressDetails>



Testing the application


Now Click on the 'Test' tab inside the xquery editor for testing




Now we have successfully created an xquery and tested it. 

 Testing the XQuery inside OSB Message Flow

      Create a new sample osb project. If you are a beginner you can refer the below post

 In the request flow drag one 'replace' node 

     Click on 'XPath' and enter the value as '*'

     In Variable : body
     Now click on 'Expresssion' and click on 'XQuery Resource' and browse to the sample xquery
     and enter $body/* into the 'requestDoc'.


Now you  can deploy the application and test it.


Conclusion
   This topic is intended to give an introduction to Xquery development and using the same inside the osb message flow. You can better explore more.

Queries?

    please contact Sajeev Ramakrishnan
    @ sajurrk@gmail.com
    @ saju_rrk@yahoo.com

















       

     

Saturday, July 2, 2011

OSB Dev using Eclipse - Getting Started

Introduction
   I hope that you have installed OSB 11g and created domain. Now it is the time to make your hands dirty. I will explain to you how to create a basic http-http flow using eclipse. So why to wait, open your eclipse and go on!!.  


Definitions

  • Oracle Service Bus Configuration Project - After opening the eclipse create the osb configuration project which hold multiple osb projects.
  • OSB project - holds the actual application which consists of proxy services and business services.
  • Proxy Service - which holds the actual flow implementation. It can perform routing, transformation,sercurity, monitoring and reporting
  • Business Service , which acts as an abstract access layer for the end system component where we configure the interface. Proxy service calls the end system using business service. Business services can be of HTTP, JMS, MQ, File , FTP etc.
Sample Flow (HTTP-HTTP)

Open the Eclipse and create Oracle Service Bus Configuration Project


Right click on the Oracle Service Bus Configuration project and create a new Oracle Service Bus project

Give some proper name


Right click on the Oracle Service Bus project and create new proxy service.


Open the new proxy service and click on the 'Transport' section. Select the protocol as 'http' and give a proper HTTP access URI.


Click on the 'Message Flow' section on the proxy service and drag a 'pipeline pair' to the message flow.



You can see 'Request pipeline' and 'Response pipeline' inside the pipeline pair.


Drag a 'stage' into the Request pipeline. Stage is used just to group different nodes in the flow.


Now Right click on the Oracle Service Bus Project and create a new 'business service'


Open the new business service and click on 'Transport' section . Configure 'http' as protocol and add one proper end system URI. In the figure given below, it is configured as http://www.google.com. Instead please configure any tomcat stub which gives any xml as the output.


Go back to the proxy service. Drag 'Service call out' to the 'stage'. The service call out is used to initiate a request to the end system with the help of business service and get back the response.


Click on the service call out and then click on the 'Browse' button below and select the business service.



Enter the Request variable as 'body' and response variable as 'response'. You can use any name for the response variable. But for the request variable you should use 'body' as the request xml resides in the 'body' variable.



Drag a 'replace' node to the response pipeline pair and configure it. This will copy the response obtained from the downstream to the body variable so that the response will be returned to the client.



Now the application is ready and it need to be deployed. For that we have to add the server to the workspace. 


Select the appropriate server



Select the domain directory



Finish creating the server and right click on the server created and select 'Add and Remove' and add your Oracle Service Bus Configuration Project to the server.



Right click on the 'Server' and click on 'start'. After some time the server will go to the 'Running' state.


Right click on the server and click on 'publish' so that your application will be deployed .

Testing the application
    Right click on the proxy service and select 'Run As' and select 'Run on Server' . A new window will be opened and paste some xml and hit run. If there are no errors in the end system stub, you will get proper output.

Note : Make sure that your managed server is running before testing the application.



Paste one xml on the 'Payload' section and hit 'Execute'


If your stub is working properly, You can see the proper response.



Conclusion
    This topic is just intended to kick start the development. There are more things ahead. Any way you have taken the first step of OSB application development. Try to explore more in it.

Queries?

    please contact Sajeev Ramakrishnan
    @ sajurrk@gmail.com
    @ saju_rrk@yahoo.com





Saturday, June 25, 2011

Oracle Fusion Middleware PPT

This will give an introduction to Oracle Fusion Middleware and spots where the Oracle Service Bus stands in the Oracle Middleware products. Also this explains in detail the creation of domain with complete screenshots. This will be helpful for those who want to get a start in Oracle Service Bus (OSB). Please download the PPT

Oracle Fusion Middleware with OSB - Introduction