Tuesday, October 27, 2009

Easy binding of Oracle Fusion Middleware B2B 11g with a SCA composite using the B2B adapter

In my previous posting,I have described how to set up a simple XML document exchange configuratation in Oracle Fusion Middleware B2B 11g. In this posting I will show how to use the new B2B adapter part of SOA Suite 11g to easily send out XML orders from a SCA composite.

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.

B2B adapter
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.

Figure 1

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.

Figure 2

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)

Figure 3

 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 :)


Anonymous said...

Thanks for your helpful documentation. I am getting the below error while running a test case em, can you please help me? Thanks!

B2B-50029: B2B runtime error
at oracle.tip.b2b.tpa.TPAProcessor.processTPA(TPAProcessor.java:539)
at oracle.tip.b2b.tpa.TPAProcessor.processOutgoingTPA(TPAProcessor.java:222)
at oracle.tip.b2b.engine.Engine.processOutgoingMessageImpl(Engine.java:1458)
at oracle.tip.b2b.engine.Engine.processOutgoingMessage(Engine.java:805)
at oracle.tip.b2b.engine.Engine.handleMessageEvent(Engine.java:3797)
at oracle.tip.b2b.engine.Engine.processEvents(Engine.java:3214)
at oracle.tip.b2b.engine.ThreadWorkExecutor.processEvent(ThreadWorkExecutor.java:698)
at oracle.tip.b2b.engine.ThreadWorkExecutor.run(ThreadWorkExecutor.java:212)
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)

Error -: B2B-50014:

Anonymous said...

i am getting the same error .how to solve it?

Anonymous said...

I am getting the same error. Any one has solution yet?