Tuesday, November 19, 2013

Debug OSB in Eclipse

The following steps will allow you to debug your OSB services in Eclipse a local weblogic server.

1)  Start your server
2)  Open Eclipse
3)  Create a Debug Configuration. Run -> Debug Configurations

4)  Right click on Oracle Service Bus Debugger and select New

5) Enter a Name for your debug config and the debug Host and Port information for your OSB server.  Then click Debug.

6) Add a break point to your OSB service.  This can be done by right clicking on any object in your service and selecting Toggle Breakpoint.

7)  Execute your OSB service.  This can be done through the console, SoapUI or any other tool which can call a web service.

8)  Eclipse will prompt you to see if you would like to switch perspectives.  Select Yes.

8) This will bring up the Debug Perspective and it will have stopped on the breakpoint you set.  From here you get all of the functionality that you would expect from a debugger.  You can step into code, step over code and resume processing.  There is also a window that can be used to inspect your variables.


Monday, October 14, 2013

Weblogic Certificate Error (FATAL Alert:BAD_CERTIFICATE)

I recently configured weblogic to work with a GoDaddy certificate and started getting the following error.

Error: javax.net.ssl.SSLKeyException: FATAL Alert:BAD_CERTIFICATE - A corrupt or unuseable certificate was received

The solution was to add the following startup option to weblogic.    



This error is caused when the encryption strength used to create the cert is lower than the version of java you are using to run Weblogic is expecting. 

Installing Certificate in Weblogic Keystore

If you do not have the certificate complete the following steps.
1) Open chrome (You can do this in IE or FireFox too but I just have the steps for chrome)
2) Go to the secure website your service needs to connect to.
          a.  Right click on the lock on the upper left hand side
          b.    Left click on the connections tab
          c.    Select View Certificates

          d. Select the Details tab

          e. Select Copy to file.  This will bring up the Certificate Export Wizzard.
                                                               i.      Select Next
                                                             ii.      Select DER Encoded 

          f. Select a file to hold the certificate. 

3) Get intermediary Cert (Reseller Cert).  
          a. Right click on the lock on the upper left hand side
          b. Left click on the connections tab
          c. Select View Certificates
          d. Select Certification Path tab
          e. Select the intermediary cert

         f. This will bring up a certificate window for the intermediary certificate.  Follow steps 3d-f to save this certificate

4) If the Root cert is not already installed, repeat step 3 for the root.
5) You now need to save the certificates in a keystore that will be used by Weblogic
          a. Go to the java/bin directory that is being used by weblogic.  We will use the keytool application to add the certificates.
          b. Find the keystores used by Weblogic.  By default you can use the keystores in $MiddlewareHome/wlserver_10.3/server/lib
          c. List the contents of the keystore by using the keytool –list command.  You will need to supply the keystore location.  You will also need to know the keystore password.  If you use DemoTrust.jks the default password is "DemoTrustKeyStorePassPhrase"
./keytool -list -keystore /home/oracle/Oracle/Middleware/wlserver_10.3/server/lib/DemoTrust.jks

           d. Execute the keytool – import command to import the certs.  Note: you will need to supply an alias, the location to the cert file and the location of the keystore and you will need to execute this command twice to import both the site cert and the intermediary cert.

keytool -importcert -file /media/sf_Temp/Booking/BookingCom.cer -alias bookingCom -keystore /home/oracle/Oracle/Middleware/wlserver_10.3/server/lib/DemoTrust.jks

Go Daddy (Note:  There is a new param)
keytool -trustcacerts -importcert -alias godaddy -file /tmp/GoDaddyInt.cer -keystore /home/oracle/Oracle/Middleware/wlserver_10.3/server/lib/DemoTrust.jks  -storepass DemoTrustKeyStorePassPhrase

Friday, May 24, 2013

Clearing Subclipse Stored Credentials

In order to removed the stored user credentials used by Subclipse all you need to do is to remove the .keyring file.   This file can be found in the $MIDDLEWARE_HOME that you are using for Eclipse.  


Once you remove this file all you need to do is right click on your OSB project and then select Team -> Synchronize with Repository

Wednesday, May 8, 2013

Setting Unit Of Order in OSB Producer

Unit Of Order is used in Weblogic JMS queues/topics to group messages into a single unit that can be processed sequentially even if the message are being processed by multiple consumers.  For example, you can use CustomerID for the Unit Of Order to ensure that you will always process a given customers transactions in order.

Follow the link for more information on Unit Of Order

Setting the Unit Of Order in an OSB Producer is quite simple.

1) Add a Transport Header action in the Request Action section of your communication node (Route, Publish, Service Call Out)

2) Set the Transport Header Properties
     a) For Direction select  Outbount Request.   
     b) Click on the Add Header button.
     c) Select Defined, jms, JMS_BEA_UnitOfOrder under the Name column.
     d) Select Set header to and set the <Expression> you want to use to set your Unit of Work in the Action column.

Monday, May 6, 2013

OSB Retry Application Errors

Recently our OSB administrator asked me how OSB determined what an application error was for the "Retry Application Errors" setting on the Transport page of a Business Service.  It turns out there is not much documentation on this at all.   So I did some testing.

OSB looks at the  response-code in the Response Metadata to flag an application error.  If this value is a non-zero, then it is treated as an application error.

The easiest way to manipulate this value is to add a Reply with Failure in the OSB service you are calling.

You can also manipulate the response code by inserting a response-code element in $inbound as shown below.  Note: This must be done in the response pipeline 

Note:  I only researched this for Business Services that were calling OSB Proxy Services as that was the architecture for the context of the question asked.  More research would need to be done to determine this behavior when call services outside the OSB.

Tuesday, April 23, 2013

Using CDATA to handle embedded XML

We ran into an issue when we were trying to pass embedded XML through one of our OSB processes.  The problem came up when we had duplicate namespaces between the embedded XML and the XML for our process.   OSB was combining namespace declarations and removing the namespace declaration from our embedded XML since it was already declared in the XML for our OSB process.

The solution was to wrap the embedded xml in a CDATA wrapper.  This is very easy to do in OSB by using the fn-bea:serialize function shown below.

Removing the  CDATA wrapper is also easy and can be done using the fn-bea:inlinedXML function.