Invoking an OSB service from SCA composite synchronously

In this recipe, we will invoke an OSB proxy service from an SCA composite. This is the opposite of the recipe, Invoking, a, SCA, composite, from, an, OSB, service.

The OSB service consists of a proxy service CustomerManagement accepting the call from a SOA Suite Mediator component through the SB transport. Because the CustomerManagement WSDL defines a synchronous request/reply message exchange pattern, the Mediator will wait for the proxy service to return it response message:

Invoking an OSB service from SCA composite synchronously

Getting ready

Copy the soa-suite-invoking-osb-service-sync-from-sca-composite holding the JDeveloper project from chapter-8getting-readyinvoking-osb-service-sync-from-sca-composite into a local workspace folder.

Import the base OSB project containing the base implementation of the proxy service together with the WSDL and XML schemas into Eclipse from chapter-8getting-readyinvoking-osb-service-sync-from-sca-composite.

How to do it...

We start on the OSB side and change the CustomerManagement proxy service, available with the base OSB project imported from the getting-ready folder, so that it can be invoked by the SCA composite. The proxy service implements a synchronous interface and contains a pipeline pair, which always returns the same response.

In Eclipse OEPE, perform the following steps:

  1. Open the CustomerManagement proxy service located in the proxy folder.
  2. Go to the Transport tab where we need to change the protocol.
  3. Choose sb as the Protocol.
  4. Deploy the project to the OSB server.

    Next, we will create a Mediator, which will call the proxy service synchronously through a direct binding reference. In JDeveloper, perfom the following steps:

  5. Open the osb-cookbook workspace in JDeveloper by selecting File | Open and navigating to the osb-cookbook.jws file.
  6. Click on the composite.xml located in the CustomerManagement project to open up the SCA composite view.
  7. Drag a Mediator component from the Service Components section of the Component Palette on the right and drop it on the Components area.
  8. Enter CustomerManagementSync into the Name field.
  9. Choose Synchronous Interface for the value of the Template drop-down listbox.
  10. Click on the magnifying glass button right to the Input field.
  11. In the Type Chooser window expand the CustomerMessages.xsd below the Project Schema Files node.
  12. Select the FindCustomer node and click on OK:
    How to do it...
  13. Click on the magnifying glass button right to the Output field.
  14. In the Type Chooser window expand the CustomerMessages.xsd below the Poject Schema Files node.
  15. Select the FindCustomerResponse node and click on OK:
    How to do it...
  16. Click on OK. This will create a new Mediator component with an exposed SOAP binding as shown i the following screenshot:
    How to do it...

    Now let's invoke the OSB proxy service from the Mediator. For that, we need to add a direct binding to the composite. In JDeveloper, perform the following steps:

  17. On the Component Palette, drag the Direct Binding from the Service Adapters section and drop it on the External References section of the SCA composite.
  18. Enter CustomerManagementDirect into the Name field.
  19. Choose Reference for the Type drop-down listbox.
  20. Choose Oracle Service Bus for the Reference Target drop-down listbox.
  21. Click on the icon with the green arrow right to the WSDL URL field.
  22. On the SOA Resource Browser pop-up window select Resource Palette and then expand theApplicationServerConnection as shown in the following screenshot:
    How to do it...
  23. Navigate to the CustomerManagment (direct) proxy service and click on OK.
  24. Enable copy wsdl and its dependent artifacts into the project option and click on OK:
    How to do it...
  25. Confirm the popup window by clicking OK.
  26. Drag a wire from the CustomerManagementDirect external reference to the CustomerManagementSync Mediator component:
    How to do it...

    Next, we will change the Mediator component so that the request as well as the response message is passed through by the static routing rule:

  27. Double-click on the CustomerManagementSync Mediator component.
  28. Click on the icon right to the Assign Value of the request.
  29. In the Assign Value pop-up window, click on the green plus icon.
  30. In the From section, select expression for the Type drop-down listbox.
  31. Enter $in.request/inp1:FindCustomer into the Expression field.
  32. In the To section, select expression for the Type drop-down listbox.
  33. Enter $out.parameters/inp1:FindCustomer into the Expression field and click on OK to close the Assign Value dialog:
    How to do it...
  34. Click on OK.
  35. Click on the icon right to the Assign Value of the synchronous reply.
  36. In the Assign Values pop-up window click on the green plus icon.
  37. In the From section, select expression for the Type drop-down listbox.
  38. Enter $in.parameters/tns:FindCustomerResponse into the Expression field.
  39. In the To section, select expression for the Type drop down listbox.
  40. Enter $out.reply/tns:FindCustomerResponseinto the Expression field and click on OK to close th Assign Value dialog.
  41. Click on OK:
    How to do it...

    Now, we can deploy the SCA composite to the SOA Suite server. In JDeveloper, perform the following steps:

  42. Right-click on the CustomerManagement project and select Deploy | CustomerManagement.
  43. Select Deploy to Application Server from the list of deployment actions and click on Next.
  44. Enable the Overwrite any existing composites with the same revision ID check box and click on Next.

    Select the ApplicationServerConnection from the list of application servers and click on Finish.

  45. Check the SOA-Log status window for errors. The deployment was successful, if a BUILD SUCCESSFUL message is shown.
  46. Next, let's test the CustomerManagement composite. In Enterprise Manager, perform the following steps:
  47. Expand the SOA node in the tree on the left.
  48. Expand soa-infra node and click on the default node.
  49. Click on CustomerManagement [1.0] in the list of composites. The details of the composite are displayed.
  50. Click on the Test tab.
  51. The Test Web Service screen is shown, which allows us to test the SOAP Binding of the composite.
  52. On the Request tab, in the Input Arguments section enter 100 into the ID field.
  53. Click on the Test Web Service button in the top-right corner.
  54. The result of the test is shown in the Response tab:
    How to do it...

How it works...

This recipe demonstrated the use case, where a SCA composite invokes an OSB WSDL-based proxy service through the SB transport. To invoke an SB proxy service, the SCA service component needs to use a Direct Binding reference of target type Oracle Service Bus.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset