< Previous | Next >

Updating the shipping policies with Local Shipping Option

In this lesson, you will implement a change to the shipping policy for local orders.

Clips and Tacks made a business decision to update the shipping policies on how to handle shipping for all local orders. You will implement Change 2 to the Clips and Tacks policy. The following table represents the Clips and Tacks service-provider endpoint capabilities (assertions) and use cases for service consumers for Change 2.
Table 1. Clips and Tacks service-provider endpoint capabilities and use cases for Change 2
Order Size and Type Internal Shipping Better Shipping International Express™ Local Shippers
Order Size = SMALL and Order Type = DOMESTIC   X    
Order Size = LARGE and Order Type = DOMESTIC   X    
Order Type = INTERNATIONAL     X  
Order Type = LOCAL       X
To create the Local Shippers endpoint in your fabric project.
  1. Switch back to the Business Services perspective in WebSphere® Integration Developer. In the Business Services Explorer, right-click Endpoint and select New > Endpoint.
    New Endpoint window
  2. Enter the name LocalShippersEndpoint, change the address to HTTP and select Next.
    New Endpoint
  3. Enter the URL; https://localhost:<SECURE_SERVER_PORT>/LocalShippersEndpoint/services/LocalShippersPort. Select Finish.
    New Endpoint Location
    The LocalShippersEndpoint editor opens.
  4. Select the Interfaces tab for this editor and click Add Existing, which is located in the upper-right corner of the Associated Interfaces table.
    Interface Selection Window
    Note: If the Add Existing is returns a blank list of interfaces, open up the advanced editor by closing the editor that is currently open, right-clicking on the endpoint and selecting Open with Advanced Editor. The advanced editor will open up with the option to select the supports service through another window for Interface Selection.
    Change 4 Note
  5. Select CalculateShippingCharges and click OK.
    Calculate Shipping Charges
  6. Select the Assertions tab for this editor and click Add, which is located in the upper-right corner of the Endpoint Capabilities table.
  7. Expand the Interoperability folder, expand the Content Based Assertion folder and then select OrderSizeAssertion and click OK.
    Order Size Assertions
  8. In the window that opens, select SMALL for the order size field and click OK.
    Order Size Assertion
    You have created an instance of this assertion type and associated it with this endpoint. There is now a row for this assertion in the table.
  9. Create an assertion for LARGE orders by repeating the previous steps for adding an assertion but this time select LARGE for the order size and click OK.
  10. Create an assertion for Local orders by repeating the previous steps for adding an assertion but this time select the following:
    1. type is an OrderTypeAssertion in the same folder as the OrderSizeAssertion type.
    2. select Required.
    3. select LOCAL for the order type.
  11. Verify that you have three rows in the Endpoint Capabilities assertion table, and close the editor. Save your work.
    Endpoint Capabilities
    Create the business service policy named NCLocalOrderType that will use the Local Shippers endpoint.
  12. Right-click Policy and select New > Policy.
    Policy window
  13. For the name, type NCLocalOrderType. Then click Browse and select Interface(2) > CalculateShippingCharges and click OK.
    Interface 2 window
  14. Click Finish.
  15. In the Policy editor, type 1 for the priority.
    Policy Information window
  16. Select the Policy Expression tab for this editor. Inside the Expression panel and select Add > Operator > AND.
    Policy window
  17. Inside the Expression panel, right-click AND and select Add > Condition > Assertion.
  18. In the window that opens, select postalCode for the content type and select is greater than or equal in the Comparison field.
  19. Click Add Content and type 27006 for the postal code. Click OK twice.
    Expression builder
  20. Repeat the previous 3 steps to add a condition but this time select is less than or equal in the Comparison field and 28698 for the postal code.
  21. Verify that the content in your Policy Expression panel matches what is shown below.
    Policy Expression
  22. Click Add in the Assertion table of the Policy Expression tab for this editor.
  23. Expand the Interoperability folder, expand the Content Based Assertion folder, select OrderTypeAssertion this time, and click OK.
  24. In the window that opens, clear the Required check box, select Fill from Context, select LOCAL for the order type, and click OK.
    Assertion Options
  25. Save your work.
    Order Type assertion
  26. Browse the Clips&Tacks fabric project. You can see that there are already two other local policies defined:
    • SCLocalOrderType is defined as any postal code between 29001 and 29449.
    • VALocalOrderType is defined as any postal code between 20101 and 22942.
    All of these policies set the OrderTypeAssertion to LOCAL and so will result in the fabric choosing the LocalShippers Endpoint.
  27. Simulate Change 2 by following the steps as outlined in the section Simulating the initial shipping policies, changing the values of the Test Verify Shipper selection page to the following values:
    • CountryAssertion = USA
    • PostalCodeAssertion = 27519
    • TotalPriceAssertion = 100
    The Simulation Operations panel shows only green check marks and the LocalShippersEndpoint is selected.
  28. Publish your local changes to the business services repository by following the steps as outlined in the section Using Governance to manage changes. On the Governance page of the Clips And Tacks Fabric space, update your comments to be appropriate for Change 2.
To complete Change 2, you need to run a runtime test. For the actual runtime test, follow the steps as outlined in the section Testing the initial shipping policies. Use the same input values provided there for the form except for the Postal Code, which should be set to a value between 27006 and 28698 causing the Local Shipping endpoint to be selected. Run a second test with a Postal Code outside the three local ranges, any code that does not begin with the digit 2 will work, to see which shipping service is selected.
< Previous | Next >