Monday, February 21, 2011

Logging in Java callouts in B2B


In this blog I will explain on how to log required information from Callout java class in B2B into the soa server log files, so as to help you in debugging issues related to Callout.
In some case while using the Callout classes, we will get B2B runtime errors but there will not be any definite pointers on where the error happened in the java callout classes. For developers who are writing Callout classes for first time would love to see the system out printlns to be printed in the log files.
There is a java class named DiagnosticService in oracle.tip.b2b.system package of b2b.jar. You can make use of the different log methods available in the class as we do for log4j or other logging frameworks, depending on the amount of information you have at the point of time.
Logging Methods available in Diagnostic service
public static void log(Level level, Throwable t)
public static void log(Throwable t)
public static void log(Level level, String msg)
public static void log(String msg)
public static void log(int component, int severity, String message)
public static void log(int component, String componentName, int severity, String message)
  
Severity levels
1.     DIAGNOSTICS_ALL = -6;
2.     DIAGNOSTICS_DEBUG = -5;
3.     DIAGNOSTICS_INFORMATION = -4;
4.     DIAGNOSTICS_WARNING = -3;
5.     DIAGNOSTICS_ERRORS = -2;
6.     DIAGNOSTICS_FATAL = -1;
7.     DIAGNOSTICS_NONE = 0;

Component Levels
1.     REPOSCOMPONENT = 0;
2.     IPCOMPONENT = 1;
3.     BLLCOMPONENT = 2;
4.     B2BCOMPONENT = 3;
5.     MVECOMPONENT = 4;
6.     RULECOMPONENT = 5;
7.     AFCOMPONENT = 6;
8.     TRANSFORMCOMPONENT = 7;
9.     TRANSLATECOMPONENT = 8;
10.  TSCOMPONENT = 9;
11.  RTCOMPONENT = 10;
12.  DEPLOYCOMPONENT = 11;
13.  CORRELATIONCOMPONENT = 12;
14.  DVMCOMPONENT = 13;
15.  REPORTCOMPONENT = 14;
16.  ADAPTERCOMPONENT = 15;
17.  UICOMPONENT = 16;
18.  PURGECOMPONENT = 17;


Sample Code Snippet
1.     Write a private method with the call to Diagnostic service log method (better practice for auditing)
private static void b2blog(Object message)  {
DiagnosticService.log(3, -2, (new StringBuilder()).append("").append(message).toString());
}

2.     Usage :-When you need to log an audit message
b2blog((new StringBuilder()).append("TestCallout execute() - Context parameters: = ").append(calloutContext.getAllProperties()).toString());
3.     Usage :-When you need to log an Exception
Catch(Exception ex){
DiagnosticService.log(ex);
}

That’s it for now.        

Wednesday, February 2, 2011

SOAP 1.1 Binding in WSDL @ SOASuite 11G


One of the queries which I got recently was on the SOAP bindings in 11g. The scenario is like this. The  SOA environment is 11g and it needs to integrate with OTM system. In 11g, by default the WSDL bindings uses SOAP 1.2 version for creating bindings. OTM system expects SOAP 1.1 version. 

The solution is simple. The Jdev provides options for creating different types of bindings in the design mode.
  1.   Open the wsdl
  2.   Go to Design Mode
  3.   In component Pallete there will be binding option
  4.   Drag and drop binding into the Bindings window of the Design page of WSDL.

5.                      A Create Binding pop-window will appear.You need to select the binding ,and SOAP 11 is listed as one of the options.
That’s it .You are done J