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 2Order 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.
- Switch back to the Business Services perspective in WebSphere® Integration Developer. In the Business
Services Explorer, right-click Endpoint and
select .
- Enter the name LocalShippersEndpoint, change
the address to HTTP and select Next.
- Enter the URL; https://localhost:<SECURE_SERVER_PORT>/LocalShippersEndpoint/services/LocalShippersPort. Select Finish. The LocalShippersEndpoint editor opens.
- Select the Interfaces tab for this editor
and click Add Existing, which is located in
the upper-right corner of the Associated Interfaces table.
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.
- Select CalculateShippingCharges and click OK.
- Select the Assertions tab for this editor
and click Add, which is located in the upper-right
corner of the Endpoint Capabilities table.
- Expand the Interoperability folder, expand
the Content Based Assertion folder and then
select OrderSizeAssertion and click OK.
- In the window that opens, select SMALL for
the order size field and click OK.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.
- 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.
- Create an assertion for Local orders by repeating the previous
steps for adding an assertion but this time select the following:
- type is an OrderTypeAssertion in the same
folder as the OrderSizeAssertion type.
- select Required.
- select LOCAL for the order type.
- Verify that you have three rows in the Endpoint Capabilities assertion
table, and close the editor. Save your work.Create the business service policy named NCLocalOrderType that
will use the Local Shippers endpoint.
- Right-click Policy and select .
- For the name, type NCLocalOrderType. Then
click Browse and select and
click OK.
- Click Finish.
- In the Policy editor, type 1 for
the priority.
- Select the Policy Expression tab for this
editor. Inside the Expression panel and select .
- Inside the Expression panel, right-click AND and
select .
- In the window that opens, select postalCode for
the content type and select is greater than or equal in
the Comparison field.
- Click Add Content and type 27006 for
the postal code. Click OK twice.
- 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.
- Verify that the content in your Policy Expression panel
matches what is shown below.
- Click Add in the Assertion table
of the Policy Expression tab for this editor.
- Expand the Interoperability folder, expand
the Content Based Assertion folder, select OrderTypeAssertion this
time, and click OK.
- In the window that opens, clear the Required check
box, select Fill from Context, select LOCAL for
the order type, and click OK.
- Save your work.
- 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.
- 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.
- 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.