Skip to main content

Data & Intelligence

Datapower XI 52 and XC 10 Integration:Encode/decode the cache key

From our previous blog post we have seen how easy it is to setup a seamless integration between the XI 52 and XC 10. In this blog post, we dive into a little more detail of the seamless integration by understanding how datapower encodes and decodes the cache key.

Datapower XI 52 and XC 10 Integration: Encode/decode the cache keyDatapower XI 52 uses the URL as the cache key for the storing and retrieving of the object from XC 10 caching device. When a request is made to the XI52, XI 52 will make a call to the backend and store the successful response in XC 10 device with encoded URL as cache key. For the consecutive requests XI 52 will use the encoded request URL as cache key to retrieve it from the cache. The conversion of the URI into cache key is two-step process,

  1. The request URL is base64 encoded with input character set as UTF-8
  2. Then result is then URL encoded.

The result will be a cache key which can be used to retrieve the cached object.

For example,

  1. Let’s assume the request URL for a service on Datapower XI 52 with seamless integration enabled with XC 10 stored in grid name “physician” is
    http://www.hospitial.com:5454/physician/appointments/list?StartDate=08/14/2014&EndDate=08/26/2014
  2.  The base 64 encoded version will be
    aHR0cDovL3d3dy5ob3NwaXRpYWwuY29tOjU0NTQvcGh5c2ljaWFuL2FwcG9pbnRtZW50cy9saXN0P1N0YXJ0RGF0ZT0wOC8xNC8yMDE0JkVuZERhdGU9MDgvMjYvMjAxNA==
  3.  By URL encoding the above result we will get the cache key aHR0cDovL3d3dy5ob3NwaXRpYWwuY29tOjU0NTQvcGh5c2ljaWFuL2FwcG9pbnRtZW50cy9saXN0P1N0YXJ0RGF0ZT0wOC8xNC8yMDE0JkVuZERhdGU9MDgvMjYvMjAxNA%3D%3D
Data Intelligence - The Future of Big Data
The Future of Big Data

With some guidance, you can craft a data platform that is right for your organization’s needs and gets the most return from your data capital.

Get the Guide

To retrieve the cached object using the cache key we need to point to correct data grid.

https://CacheCollective/resources/datacaches/{gridname} /{gridname.LUT}/{cachekey}

Calling the above URL with valid credentials will retrieve the cached object.In our example the URL will look like

https://CacheCollective/resources/datacaches/ physician/ physician.LUT/ aHR0cDovL3d3dy5ob3NwaXRpYWwuY29tOjU0NTQvcGh5c2ljaWFuL2FwcG9pbnRtZW50cy9saXN0P1N0YXJ0RGF0ZT0wOC8xNC8yMDE0JkVuZERhdGU9MDgvMjYvMjAxNA%3D%3D

CURL Command for cache object retrieval

curl –user <username>:<password> -k https://{XC10deviceaddress/resources/datacaches/ physician/ physician.LUT/ aHR0cDovL3d3dy5ob3NwaXRpYWwuY29tOjU0NTQvcGh5c2ljaWFuL2FwcG9pbnRtZW50cy9saXN0P1N0YXJ0RGF0ZT0wOC8xNC8yMDE0JkVuZERhdGU9MDgvMjYvMjAxNA%3D%3D

The following are the scenarios decoding the XC 10 key will be helpful

  1. Retrieve the object stored using seamless integration from different Multi-protocol gateway.
  2. Building the URL to call through CURL/command line
  3. Debugging the integration issues

Links

  1. Base 64 encoding http://www.base64encode.org/
  2. URL encoder http://meyerweb.com/eric/tools/dencoder/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.