Creating a Callout Oracle Fusion Middleware Online Documentation Library

13-8 Oracle Fusion Middleware Users Guide for Oracle B2B After you create a callout, it is available to include in an agreement. See Section 13.3, Including a Callout in an Agreement, for more information. If you change a callout after it is deployed with an agreement, a server restart is required. To create a callout: 1. Click Administration, and then Callout. 2. In the Callout section, click Add. 3. Enter a name for the callout. You may want to indicate if you are creating a transport callout in the name. 4. Enter callout details, as described in Table 13–1 .

5. Optional Click Add in the Parameters section.

6. Enter a parameter name and attributes, as described in Table 13–2 .

7. Click Save.

You can edit the details, parameters, or parameter values at any time, but not the callout name.

13.3 Including a Callout in an Agreement

After you create a callout, it is available to include in an agreement, as shown in Figure 13–4 . Figure 13–4 Specifying a Callout in an Agreement Table 13–2 Callout Parameter Attributes Field Description Name Enter a parameter name. Type Select from Integer, Float, String, Boolean, or Date types. The format for the Date type is MMDDYYYY. Note: Changing a type can invalidate the parameter default value. Value Enter a value. If Encrypted is set to True, then this value is encrypted. Mandatory Select True or False. Encrypted Select True or False. Description Enter an optional description. Managing Callouts 13-9 The image shows the Agreement tab. The first area of the tab shows an iconic representation of a step diagram with the following blocks from left to right: Acme, ORDERS_def, and GlobalChips. The second area of the tab shows the agreement details with the following fields: Agreement Id, Name, Description, Start Date, End Date, and Callout. To include a callout in an agreement: 1. Click Partners. 2. Click an agreement name. 3. Select a callout.

4. Click Save.

To update the value of a callout parameter for a specific agreement: 1. Click Partners. 2. Click an agreement name. 3. Select a callout.

4. Click Callout Details.

5. Enter a value for the parameter name, as shown in Figure 13–5 . Figure 13–5 Entering Callout Details The image shows the Callout Details dialog box. The first area shows of the tab the Callout Details with the following fields: Name, Description, Implementation Class, Library Name, and Timeout. The second area of the tab shows the Callout Parameters and Values as a table with the following columns: Name, Type, and Value.

6. Click OK.

13-10 Oracle Fusion Middleware Users Guide for Oracle B2B

13.4 Implementing a Callout

Example 13–2 shows how an incoming XML document is transformed to another XML document. The directory structure is oracle.tip.callout. In this example, note that setting the output CalloutMessage in the output list is required output.addcmOut. Example 13–3 shows how to create a synchronous callback callout for use with Transport Synch Callback. See Section 5.5.3, Using Transport Sync Callback for more information. Example 13–2 Code Example of an XML-to-XML Transformation import java.io.; import java.net.; import java.util.; import oracle.xml.parser.v2.; import oracle.tip.b2b.callout.Callout; import oracle.tip.b2b.callout.CalloutMessage; import oracle.tip.b2b.callout.CalloutContext; import oracle.tip.b2b.callout.exception.; This sample callout transforms the incoming XML document to another XML document. It also shows how to generate Functional Ack and Error message. public class XSLTCalloutImpl implements Callout { public void executeCalloutContext context, List input, List output throws CalloutDomainException, CalloutSystemException { try { 1 Retrieve the callout properties from CalloutContext String xsltFile = context.getStringPropertyxsltFile; 2 Get the input callout message CalloutMessage cmIn = CalloutMessageinput.get0; 3 Process the message instantiate a stylesheet URL xslURL = new URLfile: + xsltFile; XSLProcessor processor = new XSLProcessor; XSLStylesheet xsl = processor.newXSLStylesheetxslURL; parser input XML content DOMParser parser = new DOMParser; parser.setPreserveWhitespacetrue; parser.parsenew StringReadercmIn.getBodyAsString; XMLDocument xml = parser.getDocument; processor.showWarningstrue; processor.setErrorStreamSystem.err; Transform the document StringWriter strWriter = new StringWriter; processor.processXSLxsl, xml, new PrintWriterstrWriter; 4 Create a output callout message create a callout output message Managing Callouts 13-11 CalloutMessage cmOut = new CalloutMessagestrWriter.getBuffer.toString; strWriter.close; create Functional Ack callout message this is an optional step CalloutMessage fa = new CalloutMessageset FA payload here; fa.setParameterfunctional_ack, true; setting your own doctype and revision set the doc type name and revision as defined in b2b ui fa.setParameterdoctype_name, fa; fa.setParameterdoctype_revision, 1.0; create Error callout message this is an optional step CalloutMessage err = new CalloutMessage set the payload that causes this error ; err.setParametererror_message, true; err.setParametererror_desc, set the error desc; output.addcmOut; output.addfa; output.adderr; 5 Throw an exception, if any } catch Exception e { throw new CalloutDomainExceptione; } } } Example 13–3 Code Example of a Sync Callback Callout import java.io.FileInputStream; import java.util.List; import java.util.Properties; import oracle.tip.b2b.callout.Callout; import oracle.tip.b2b.callout.CalloutContext; import oracle.tip.b2b.callout.CalloutMessage; import oracle.tip.b2b.callout.exception.CalloutDomainException; import oracle.tip.b2b.callout.exception.CalloutSystemException; import oracle.tip.b2b.domain.B2BParameters; import oracle.tip.b2b.system.B2BRuntimeException; import oracle.tip.b2b.system.ErrorKeys; public class SyncSampleCallout implements Callout { public void executeCalloutContext calloutContext, List input, List output throws CalloutDomainException, CalloutSystemException { try { CalloutMessage message = new CalloutMessage; Properties properties = new Properties; properties.putFROM_PARTY, MarketInc; properties.putB2BParameters.TO_PARTY, OracleServices; properties.putB2BParameters.DOCTYPE_NAME, 271; properties.putB2BParameters.DOCTYPE_REVISION, 4010X092A1; message.setParametersproperties;