2 Replies Latest reply: Mar 22, 2013 6:16 AM by Anuj Dwivedi--Oracle RSS

    Callout java class not receiving payload from B2B

    user13439586
      Hi All,

      I am working on Oracle B2B 11g(version is 11.1.1.6.0). I have the below requirement.

      Requirement: Need to pick up a zip file from a location using a File Channel and unzip the file using a java callout and then dump the unzipped files to another location.

      Below are the steps I followed.

      1. Created an inbound file listening channel to pick the zip file from a location. Specified the Filename format like *%TO_PARTY%_%FROM_PARTY%_%DOCTYPE_REVISION%_%DOCTYPE_NAME%.zip* in order for B2B to identify the Sender, Receiver and Agreement

      2. Configured the Document version, Document type and Document definition under Custom as suggested in the below link.
      https://blogs.oracle.com/ateamsoab2b/entry/using_oracle_b2b_to_send

      3. Created a File Channel under Host Partner's Channels tab to write the file to another location and given Filename format as %FROM_PARTY%.zip

      4. Imported the Document definition under Remote partner's Documents tab and created the agreement and used the channel created in step 3 in the agreement at host partner side.

      5. Initially, as a first step, tested the agreement without any java callout ( by dropping the file in the inbound location) . The zip file is successfully moved to another location by Oracle B2B. Note that no callout is used in the agreement at this point.

      6. Now included a java callout at agreement level to unzip the contents and to dump the unzipped files to another location as this is my actual requirement. Note that Callout jar file is placed in the server and the managed server is bounced in order for the callout jar to take effect.

      7. Below is my java callout class.

      package com.lol;

      import java.io.File;
      import java.io.FileOutputStream;
      import java.io.IOException;

      import java.util.List;
      import java.util.zip.ZipEntry;
      import java.util.zip.ZipInputStream;

      import oracle.tip.b2b.callout.;*
      import oracle.tip.b2b.callout.exception.;*
      import oracle.tip.b2b.system.DiagnosticService;

      *public class UnzipCallout implements Callout {*
      public void execute(CalloutContext context, List input,
      List output) throws CalloutDomainException,
      *CalloutSystemException {*
      *try {*

      b2blog((new StringBuilder()).append("********* START OF CALLOUT ***********"));*
      *CalloutMessage cmIn = (CalloutMessage)input.get(0);*
      *//create output directory is not exists*
      *String outputFolder = "D:\\LOL\\B2B\\Unzip";*
      *byte[] buffer = new byte[1024];*
      *//get the zip file content*
      *ZipInputStream zis =*
      *new ZipInputStream(cmIn.getBodyAsInputStream());*
      *b2blog((new StringBuilder()).append("Callout execute: **** AFTER READING input stream into zip input stream ****"));*
      *//get the zipped file list entry*
      *ZipEntry ze = zis.getNextEntry();*
      *while (ze != null) {*
      *String fileName = ze.getName();*
      *//System.out.println("Callout execute: file name: " +ze.getName());*
      *b2blog((new StringBuilder()).append("Callout execute: file name: ").append(ze.getName()));*
      *File newFile =*
      *new File(outputFolder + File.separator + fileName);*

      *b2blog((new StringBuilder()).append("Callout execute: file unzip = ").append(newFile.getAbsoluteFile()));*
      *//create all non exists folders*
      *//else you will hit FileNotFoundException for compressed folder*
      *new File(newFile.getParent()).mkdirs();*
      *FileOutputStream fos = new FileOutputStream(newFile);*
      *int len;*
      *while ((len = zis.read(buffer)) > 0) {*
      *// System.out.println("Callout execute: file unzip = inside file write");*
      *b2blog((new StringBuilder()).append("Callout execute: file unzip = inside file write"));*
      *fos.write(buffer, 0, len);*
      *}*
      *fos.close();*
      *ze = zis.getNextEntry();*
      *}*
      *zis.closeEntry();*
      *zis.close();*
      *} catch (IOException e) {*
      *throw new CalloutDomainException(e);*
      *}*
      *}*

      *private static void b2blog(Object message) {*
      *DiagnosticService.log(3, -2,*
      *(new StringBuilder()).append("").append(message).toString());*
      *}*
      *}*

      8. Finally I dropped the file and tested the agreement but this time it is failing with B2B-50029: B2B runtime error.

      If you notice my above java callout class, only the first log message '********** START OF CALLOUT ***********' was printed in the logs. It seems exception is occurring when executing line CalloutMessage cmIn = (CalloutMessage)input.get(0);

      One thing I noticed in the B2B reports is, when I look for the payload under wire message, it is showing as empty. Is the above statement is failing because the callout is getting empty message from input? Or am I doing anything wrong here?

      Can someone please guide me?

      Below are the few lines from diagnostic log.

      *[2013-03-20T23:13:57.734+05:30] [soa_server1] [TRACE] [] [oracle.soa.b2b.engine] [tid: [ACTIVE].ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: synchedLog_J] oracle.tip.b2b.callout.CalloutExecuteWorker:doWork CalloutExecuteWorker.doWork() Now executing callout..*
      *[2013-03-20T23:13:57.734+05:30] [soa_server1] [ERROR] [] [oracle.soa.b2b.engine] [tid: [ACTIVE].ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [APP: soa-infra] ********** START OF CALLOUT ************
      *[2013-03-20T23:13:57.843+05:30] [soa_server1] [TRACE] [] [oracle.soa.b2b.engine] [tid: [ACTIVE].ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: synchedLog_J] oracle.tip.b2b.callout.CalloutExecuteWorker:doWork CalloutExecuteWorker.doWork() Callout domain exception for UnzipCallout while working for oracle.tip.b2b.callout.B2BCalloutHandler@10ab93a Thread no = 0 Exception = null Execute status = DONE WITH DOMAIN Exception*
      *[2013-03-20T23:13:57.843+05:30] [soa_server1] [TRACE] [] [oracle.soa.b2b.engine] [tid: [ACTIVE].ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: synchedLog_J] oracle.tip.b2b.callout.CalloutExecuteWorker:doWork Notify oracle.tip.b2b.callout.B2BCalloutHandler@10ab93a*
      *[2013-03-20T23:13:57.843+05:30] [soa_server1] [TRACE] [] [oracle.soa.b2b.engine] [tid: [ACTIVE].ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: synchedLog_J] oracle.tip.b2b.callout.CalloutExecuteWorker:run CalloutExecuteWorker.run() Stop callout execute threadUnzipCallout Thread no = 0*
      *[2013-03-20T23:13:57.843+05:30] [soa_server1] [TRACE] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: synchedLog_J] oracle.tip.b2b.callout.CalloutExecuteWorker:getCalloutExecuteStatus CalloutExecuteWorker.start() Returning the callout UnzipCallout execute status for oracle.tip.b2b.callout.B2BCalloutHandler@10ab93a = 2*
      *[2013-03-20T23:13:57.843+05:30] [soa_server1] [TRACE] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: synchedLog_J] oracle.tip.b2b.callout.B2BCalloutHandler:executeCallout Execution finished by Execute worker = UnzipCallout status = 2 Process time 109*
      *[2013-03-20T23:13:57.843+05:30] [soa_server1] [TRACE] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: synchedLog_J] oracle.tip.b2b.callout.B2BCalloutHandler:executeCallout Callout exception has occured*
      *[2013-03-20T23:13:57.859+05:30] [soa_server1] [TRACE:32] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: log] msgKey = B2B-50029*
      *[2013-03-20T23:13:57.875+05:30] [soa_server1] [TRACE:32] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: log] getMsgKey = B2B-50029: B2B*
      *[2013-03-20T23:13:57.937+05:30] [soa_server1] [TRACE:32] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: log] MessageRepository.getResourceBundleWorkmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms[[*
      *138*
      *]]*
      *[2013-03-20T23:13:57.937+05:30] [soa_server1] [TRACE:32] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: log] MessageRepository.getResourceBundleWorkmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms[[*
      *138*
      *]]*
      *[2013-03-20T23:13:57.937+05:30] [soa_server1] [TRACE:32] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: log] MessageRepository.getResourceBundleWorkmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms[[*
      *138*
      *]]*
      *[2013-03-20T23:13:57.937+05:30] [soa_server1] [TRACE:32] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: log] MessageRepository.getResourceBundleWorkmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms[[*
      *138*
      *]]*
      *[2013-03-20T23:13:57.937+05:30] [soa_server1] [TRACE:32] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: log] MessageRepository.getResourceBundleWorkmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms[[*
      *138*
      *]]*
      *[2013-03-20T23:13:57.937+05:30] [soa_server1] [TRACE:32] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: log] MessageRepository.getResourceBundleWorkmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms[[*
      *138*
      *]]*
      *[2013-03-20T23:13:57.937+05:30] [soa_server1] [TRACE:32] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: log] MessageRepository.getResourceBundleWorkmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms[[*
      *138*
      *]]*
      *[2013-03-20T23:13:57.937+05:30] [soa_server1] [TRACE:32] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [SRC_CLASS: oracle.tip.b2b.system.DiagnosticService] [APP: soa-infra] [SRC_METHOD: log] MessageRepository.getResourceBundleWorkmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms[[*
      *138*
      *]]*
      *[2013-03-20T23:13:57.937+05:30] [soa_server1] [ERROR] [] [oracle.soa.b2b.engine] [tid: Workmanager: , Version: 0, Scheduled=false, Started=false, Wait time: 0 ms\r\n] [userId: <anonymous>] [ecid: 97ba68e5ad75a24e:-5fdcbf6a:13d88d4a377:-8000-00000000000012e0,0] [APP: soa-infra] Error -: B2B-50029: B2B runtime error[[*
      *Error -: B2B-50029: B2B runtime error*
      *     at oracle.tip.b2b.callout.B2BCalloutHandler.executeCallout(B2BCalloutHandler.java:961)*
      *     at oracle.tip.b2b.callout.B2BCalloutHandler.invokeCallout(B2BCalloutHandler.java:681)*
      *     at oracle.tip.b2b.callout.B2BCalloutHandler.processIncomingCallout(B2BCalloutHandler.java:326)*
      *     at oracle.tip.b2b.callout.B2BCalloutHandler.handleIncomingCallout(B2BCalloutHandler.java:263)*
      *     at oracle.tip.b2b.engine.Engine.processIncomingMessageImpl(Engine.java:2631)*
      *     at oracle.tip.b2b.engine.Engine.processIncomingMessage(Engine.java:1650)*
      *     at oracle.tip.b2b.engine.Engine.incomingContinueProcess(Engine.java:4042)*
      *     at oracle.tip.b2b.engine.Engine.handleMessageEvent(Engine.java:3718)*
      *     at oracle.tip.b2b.engine.Engine.processEvents(Engine.java:3205)*
      *     at oracle.tip.b2b.engine.ThreadWorkExecutor.processEvent(ThreadWorkExecutor.java:677)*
      *     at oracle.tip.b2b.engine.ThreadWorkExecutor.run(ThreadWorkExecutor.java:211)*
      *     at oracle.integration.platform.blocks.executor.WorkManagerExecutor$1.run(WorkManagerExecutor.java:120)*
      *     at weblogic.work.j2ee.J2EEWorkManager$WorkWithListener.run(J2EEWorkManager.java:184)*
      *     at weblogic.work.DaemonWorkThread.run(DaemonWorkThread.java:30)*

      *]]*



      Thanks in advance for the help.

      Regards,
      Ramu