Tutorial: Designing a Purchase Order Processing System by Using AquaLogic Integrator

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Using JPD Transport Callback

This chapter describes how to publish to PurchaseOrderAggregatorJPD:

The PurchaseOrderProcessingService proxy invokes the PurchaseOrderFulfillment JPD via the PurchaseOrderFulfillmentJPD business service endpoint for fulfilling the order.

This chapter describes how to modify the message flow of the PurchaseOrderProcessing proxy to publish to PurchaseOrderAggregatorJPD.

 


Modifying PurchaseOrderProcessingService Proxy to Invoke PO Aggregator JPD

This section describes how to invoke the PurchaseOrderAggregatorJPD from the Purchase Order Processing Proxy that you created in Creating the PurchaseOrderProcessingService Proxy.

To Invoke PurchaseOrderAggregatorJPD
  1. From the Design Palette, expand Stage Actions > Communications, and select Publish. Drag and drop Publish node under the Process Purchase Order node, as shown in Figure 8-1.
  2. Figure 8-1 Publish Node to Invoke PurchaseOrderAggregatorJPD


    Publish Node to Invoke PurchaseOrderAggregatorJPD

    For more information about Invoking PurchaseOrderAggregatorJPD, see Creating Proxy Service to Invoke a JPD.

  3. In the Properties tab of Publish, click Browse. Select PurchaseOrderAggregatorJPDBS.biz. From the Invoking drop-down list, select AggregatePurchaseOrder.
  4. From Design Palette, expand Stage Actions > Message Processing, and select Assign node. Drag and drop Assign node into the Request pipeline.
  5. In the Properties tab of the Assign node, click Expression, and enter the following code in the XQuery Editor dialog box that is displayed:
  6. <soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <AggregatePurchaseOrder xmlns="http://www.openuri.org/" xmlns:pur="http://www.openuri.org/PurchaseOrder">
      <orderId>{$body/pur:PurchaseOrder/pur:PurchaseOrderId/text()}</orderId>
        {$body/pur:PurchaseOrder/pur:ShippingAddress}
      <customerName>{$body/pur:PurchaseOrder/pur:CustomerName/text()}</customerName>
    </AggregatePurchaseOrder>
    </soap:Body>

    Enter Variable as body.

    Figure 8-2 Assign Node - Request Pipeline


    Assign Node - Request Pipeline

You have now described the message flow to publish to PurchaseOrderAggregatorJPDBS.biz. Figure 8-3 shows the message flow.

Figure 8-3 Publishing to PurchaseOrderAggregatorService

Publishing to PurchaseOrderAggregatorService

The PurchaseOrderAggregatorJPD aggregates the results of the PurchaseOrderFulfillmentJPD and invokes the shipping service external system.

 


Modifying PurchaseOrderProcessingService Proxy to Invoke PurchaseOrderAggregator JPD

After the Purchase Order is completely processed, a callback is sent to the client using the PurchaseOrderNotificationService.proxy.

This section describes how to send a callback via ALSB.

To Create PurchaseOrderNotification Business Service (PurchaseOrderNotificationServiceJPDBS.biz )
  1. Switch to the ALSB perspective from your current perspective in Workshop for WebLogic. To select the ALSB perspective, in the BEA Workshop for WebLogic window menu, click Windows > Open Perspective > Other.... Select AquaLogic Service Bus from the Open Perspective dialog box.
  2. In Project Explorer, select ServiceAccess, and expand Business Services.
  3. Right-click on Business Services, and select New > Business Service.
  4. In the Create a new Business Service dialog box, type the File Name as PurchaseOrderNotificationServiceJPDBS, and click Next.
  5. In the Create Business Service - General Configuration (Service Access/Business Services), select WSDL Web Service Service Type, and click Browse. The Select a WSDL dialog box is displayed.
  6. Expand PurchaseOrderProcessingService.wsdl, and select ProcessPurchaseOrderSoapCallback (port), as shown in Figure 8-4, click OK.
  7. Figure 8-4 Select a WSDL


    Select a WSDL

  8. Click Next in the Create a Business Service - Transport Configuration (ServiceAccess/Business Services/) dialog box, and ensure the following:
    • Port: http
    • Endpoint URI: http://localhost:7001/PurchaseOrderNotificationService
    • Note: Remove the default endpoint. In this case it is http://examples.org.

      Click Next.

      The PurchaseOrderNotificationJPDBS.biz is created in Project Explorer. Figure 8-5 shows the business service in Design view, and in Project Explorer.

      Figure 8-5 PurchaseOrderNotificationJPDBS in Package Explorer


      PurchaseOrderNotificationJPDBS in Package Explorer

Creating PurchaseOrderNotificationService Proxy

To Create PurchaseOrderNotificationService.proxy
  1. In the Project Explorer pane, select ServiceAccess and right-click on ProxyServices, and select New > Proxy Service.
  2. In the Create a new Proxy Service dialog box, enter PurchaseOrderNotificationService as the File Name. Click Next.
  3. Select WSDL Web Service, and click Browse. Select ServiceAccess > Resources > PurchaseOrderProcessingService.wsdl > ProcessPurchaseOrderSoapCallback (port). Click OK, as shown in Figure 8-6.
  4. Figure 8-6 Select a WSDL


    Select a WSDL

    Click OK.

  5. In the Transport Configuration dialog box, ensure the following:
    • Protocol: jms
    • Endpoint URI: jms://localhost:7001/weblogic.jms.XAConnectionFactory/PurchaseOrderNotificationServiceRequest
    • Note: Ensure that the Endpoint URI location matches with the Callback Proxy Location in the JPD Transport Configuration of PurchaseOrderAggregatorJPDBS.biz.
    • Get All Headers is set to Yes. By default, this value is set to No.
    • Click Next. Figure 8-8 shows the Transport Configuration dialog box.

      Figure 8-7 Transport Configuration


      Transport Configuration

  6. In the JMS Transport Configuration dialog box, select the Is Response Required check box, and enter Response URI as jms://localhost:7001/weblogic.jms.XAConnectionFactory/PurchaseOrderNotificationServiceResponse. Click Next. Figure 8-8 shows the JMS Transport Configuration dialog box.
  7. Figure 8-8 JMS Transport Configuration


    JMS Transport Configuration

  8. Accept the default values in the next dialog box, and click Finish.

PurchaseOrderNotificationProxy is created in Project Explorer, as shown in Figure 8-9.

Figure 8-9 PurchaseOrderNotificationProxy

<b class=PurchaseOrderNotificationProxy" id="wp1048201"/>

Designing the PurchaseOrderNotificationProxy Message flow
  1. Click the Message Flow tab in PurchaseOrderNotificationProxy. From Design Palette, expand Nodes, drag and drop a Pipleline Pair under PurchaseOrderNotificationService.proxy in the Design view.
Note: A PipelinePair node consists of a Request pipeline and a Response pipeline. Pipelines can include one or more stages, which in turn include actions.
  1. Expand Nodes, drag and drop Stage node, under Request in PipelinePairNode.
  2. From the Design palette, expand Stage Actions > Communications, and select Publish. Drag and drop Publish node under Stage node.
  3. In the Properties tab of the Publish node, click Browse, and select PurchaseOrderNotificationServiceBS from the Select a Service Resource dialog box.
  4. From the Invoking drop-down list in the Properties tab, select PurchaseOrderResponse.
  5. From the Design palette, expand Stage Actions > Message Processing, and select Assign node. Drag and drop Assign node into the Publish node.
  6. In the Properties tab of the Assign node, click Expression, and enter the following code in the XQuery Editor dialog box that is displayed:
  7. $inbound/ctx:transport/ctx:request/tp:headers/tp:user-header[2]/@value

    Enter Variable as callbackURL.

    As discussed in Listing Notes:, the original callback location will be sent as a JMS property namely BEA_WLI_Target_Callback_Location by the JPD transport. We are retrieving it and will be using it to configure the outgoing business service for sending the callback to the actual JPD callback client in the next steps

  8. From Design Palette, expand Message Processing, drag and drop Insert node under the Assign node. In the Insert node, enter the following:
  9. Expression: <ctx:uri>{$callbackURL}</ctx:uri>

    Location: as first child of

    XPath: ./ctx:transport

    Variable: outbound

    Figure 8-10 shows the values in the Insert Node.

    Figure 8-10 Insert Node


    Insert Node

  10. From Design Palette, expand Message Processing, drag and drop an Assign node under the Insert node. In the Assign node Expression, enter the following code:
  11. <soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <pur:PurchaseOrderStatus xmlns:pur="http://www.openuri.org/PurchaseOrder">
    {$body/*} 
    </pur:PurchaseOrderStatus>
    </soap:Body>

    Assign body as Variable.

The callback notification is sent to the client via PurchaseOrderNotificationServiceBS.biz. Figure 8-11 shows the message flow of callback.

Figure 8-11 Message Flow

Message Flow

 


Testing the Application

Right-click on the TestClient.java file in the Package Explorer, select Run As > Run on Server to test the application as described in Testing the Application.

 


Verifying Security Context Propagation

You can review PurchaseOrderFulfillmentJPD to verify that you have not provided any username and password to accessing the external services. Do the following to verify security context propagation:

  1. In the UseCase workspace, go to Package Explorer > src > alient.client.Test.
  2. Right-click on TestClient.java, and select Run As > Run on Server.

The client is authenticated using the basic auth method when the PurchaseOrderProcessingProxy is invoked and the security context is propagated to the WLI layer (PurchaseOrderFulfillmentJPD) to ALSB to the external systems (inventory and credit card systems).


  Back to Top       Previous  Next