The SCA that we are going to build will consist of a simple SOAP interface that accepts new orders. A mediator component will route the order directly to Oracle Fusion Middleware B2B using the B2B adapter. For simplicity, we will use the same XSD structures.
JDeveloper Project and the mediator component
The first step is to create a new JDeveloper SOA project. Start with an empty composite. Drag and drop a new mediator component from the component onto the component panel of the composite diagram. Name the component ProcessOrder. Select the one-way interface type and use the same XSD input structure for the order as used in the B2B document definition configuration. Also create a composite service with SOAP bindings (checkbox). Click on 'Ok' to create the mediator component. In a later step we will specify the necessary assign and transformation actions.
In Oracle Fusion Middleware 11g the B2B adapter is introduced to make the binding of the B2B component with a SCA composite more native. The B2B adapter wizard allows the developer to browse the B2B document repository to easily select the right document type for inbound or outbound messaging with a trading partner.
Drag a B2B adapter from the component palette and drop it onto the reference service swimlane. A wizard will automatically pop up. Name the service B2B_Order_Gateway. Click 'next' and choose default as the integration type. The integration type specifies how SCA will communicate with B2B. Default means that a WSDL file with a native B2B binding will be constructed. AQ means that a JCA AQ WSDL file will be constructed. Click next and select the Fusion middleware server connection for browsing the B2B repository and click next. Choose for the option 'Send', because the composite is going to send out orders and click on next and again on next in the following screen (we use the defaults in that screen :)). In the wizard-screen Document Definition you have to browse to the ComplexOrder_Def and select it as the document definition. Click on next and on finish to complete the wizard. The B2B binding reference service will now be created and added to the SCA composite and the required artifacts will be generated.
Wiring everything together
As one of the last steps, we need to wire the mediator component to the B2B binding reference. You can do this by selecting the orange arrow (will pop-up when you hover over the Mediator component) of the mediator component and hold the left mouse button pressed, drag the mouse to the B2B binding reference service and drop the line on the orange arrow of the B2B binding component. Figure 2 shows the end result.
Double click the mediator component and generate a standard XSLT transformation to transform the input order structure to the expected order structure of the B2B reference service (Note: that JDeveloper recognises that the B2B binding reference expects a specific XML structure. Magic, isn't it? :)). Instead of using XSLT, we could also use an Assign action here.
The last thing we have to do is to inform the B2B binding reference service that we want to send an order to Acme from the host MyComposite. We use the Assign values option of the mediator component and two of the available B2B properties for this. Assign:
Acme -> b2b.toTradingPartnerId
MyCompany -> b2b.fromTradingPartnerId
(See Figure 3 for assigning properties)
Save your project and deploy it to your Oracle Fusion Middleware server and use the built-in composite test functionality of the EM console to test your SCA composite. If you have implemented the composite correctly and configured B2B correctly as well (as described in my previous posting) you will see an order in the Acme outbound file directory that you have chosen during B2B configuration after you have executed test.
'A child can do the laundry' as we name easy procedures like this in my country :)