Oracle Fusion Middleware B2B Callout Java API Reference for Oracle SOA Suite
11g Release 1 (11.1.1.6.3)

E18157-06

oracle.tip.b2b.callout
Interface Callout


public interface Callout

Callout interface for creating callouts. Here are the steps in implementing the execute() method in this interface:

  (1) Retrieve the callout properties from CalloutContext
      String xsltFile     = context.getStringProperty("xsltFile");
  
  (2) Get the input callout message
      CalloutMessage cmIn = (CalloutMessage)input.get(0);
  
  (3) Process the message
      // instantiate a stylesheet
      URL xslURL = new URL("file://" + xsltFile);     
      XSLProcessor processor = new XSLProcessor();
      XSLStylesheet xsl = processor.newXSLStylesheet(xslURL);

      // parser input XML content
      DOMParser parser = new DOMParser();
      parser.setPreserveWhitespace(true);   
      parser.parse(new StringReader(cmIn.getBodyAsString()));
      XMLDocument xml = parser.getDocument();
      processor.showWarnings(true);
      processor.setErrorStream(System.err);

      // Transform the document
      StringWriter strWriter = new  StringWriter();
      processor.processXSL(xsl, xml, new PrintWriter(strWriter));
  
  (4) Create a output callout message
      // create a callout output message
      CalloutMessage cmOut = 
          new CalloutMessage(strWriter.getBuffer().toString());
      strWriter.close();

      // create Functional Ack callout message
      CalloutMessage fa = new CalloutMessage();
      fa.setParameter("functional_ack", "true");
      // setting your own doctype and revision
      //set the doc type name and revision as defined in b2b ui
      fa.setParameter("doctype_name", "fa"); 
      fa.setParameter("doctype_revision", "1.0");

      // create Error callout message
      CalloutMessage err = new CalloutMessage();
      err.setParameter("error_message", "true");
      err.setParameter("error_desc", "set the error desc");

      output.add(cmOut);      
      output.add(fa);
      output.add(err);
  
  (5) Throw an exception, if any
      try {} catch (Exception e) { throw new CalloutDomainException(e)};
  


Method Summary
 void execute(CalloutContext calloutContext, java.util.List input, java.util.List output)
          The execute() method contains the actual business logic of a callout.
 

Method Detail

execute

void execute(CalloutContext calloutContext,
             java.util.List input,
             java.util.List output)
             throws CalloutDomainException,
                    CalloutSystemException
The execute() method contains the actual business logic of a callout.

Parameters:
calloutContext - contains callout and usage properties. The B2B Engine provides a default implementation of this interface and hence the user is not expected to implement this interface.
input - contains the input callout messages for the callout.
output - contains the return callout messages. If one of the return message is a functional acknowledgment, then that callout message should have a message property functional_ack=true
Throws:
B2BDomainException - when there are domain exceptions
CalloutDomainException
CalloutSystemException

Oracle Fusion Middleware B2B Callout Java API Reference for Oracle SOA Suite
11g Release 1 (11.1.1.6.3)

E18157-06

Copyright © 2007, 2012, Oracle and/or its affiliates. All rights reserved.