Tuesday, March 1, 2011

more on Callout feature @B2B


Callout is one of the features given in B2B to achieve custom functionality which is not supported out of the box by Oracle B2B.The custom functionality can be written in java where you will get access to the payload and can be worked upon based on the requirements.
There are two ways in which we can use the callout.
  1. Transport Callouts
  2.  Agreement Callouts
In this blog I will touch upon some of the major differences/similarities between these 2 callouts.
Transport Callout
  1.  Configure a Channel at Host or trading partner level, depending on whether the document flow is Inbound and outbound.
  2. Select the java callout for Transport callout attribute under Channel Attributes.
·         For the inbound message, B2B invokes the transport callout immediately after it receives a message from the transport.
·         For the outbound message, B2B invokes the transport callout immediately before it sends a message to the transport.
  1. When you call it from Transport level, java callout will get following metadata information as message parameters to the java callout along with message payload.
Filename , callout.class, DATE, callout.timeout, file.sender.type, callout.library,
TO, callout.param.BASE_LOCATION, callout.name, FROM, MESSAGE-ID

Eg sample data:
filename=Geo_2011Feb23_06_20_02_014_308_284.dat
callout.class=com.geo.b2b.callout.ArchiverTest
DATE=Wed, 23 Feb 2011 11:20:01 GMT
callout.timeout=30
file.sender.type=BINARY
callout.library=TestCallout.jar
TO=OracleINC
callout.param.BASE_LOCATION= /tmp/ARCHIVE
callout.name=TestCallout
FROM=Geo
MESSAGE-ID=34323438343736363736353


Agreement Callout
In case we decide to go callout at Agreement level,
  1. Create an agreement at partner level
  2. While defining callout, we will declare all the callout parameters that need to be passed to the Callout function. These values can be modified while defining the callout at agreement level for each TP.
points to note:
  1. In the case of Agreement level callout, the transport level metadata information will not be available to the java callout. In case we require similar information these will have to be first configured as parameters while defining a callout and these values will have to be passed as callout parameters while defining the agreement.
  2. In case of a outbound flow, when we are archiving a file from transport level using a callout will store the payload as a Edi document where as the payload archived at agreement level will be in XML format. So in case the business requirement is to archive EDI format documents, then always use Transport level callouts.(This is applicable in cases we are not using the out-of the box archiving feature.)
  3. Transport callout takes precedence over Agreement callout, and so in case we enable the same callout at both levels, and try to update parameters of callout, parameter value updating at agreement level will not affect the callout behavior.
  4. Use DiagnosticService for logging audit information (explained in one of my previous blogs) which will help you in debugging.
Hope this helps. J

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