Skip to end of metadata
Go to start of metadata

Loading Data From External Applications And Services

It is possible to load data into an AMS message from an external web application or service. This can be used as a way to look up records from external databases.

To allow AMS to load data from an external web application you must provide a web service accessible over the internet using HTTP or HTTPS that accepts a XML POST request and replies with a correctly formatted XML response.

General Request - Response Process

  1. User selects Remote Load command from the phone menu.
  2. Current data in the message is sent to the AMS message gateway.
  3. This data is transformed into XML.
  4. The message XML is wrapped inside a XML tag with name "remoteLoadRequest"
  5. An optional "authKey" attribute is added to the "remoteLoadRequest" element and as a custom HTTP header with name "x-ams-auth-key". This key is an encrypted version of the key provided in the Remote Load command definition, details of the format are provided below.
  6. The XML is sent as an HTTP form POST to the url provided in the Remote Load command definition.
  7. The response from the remote server, if successful, is read and parsed by the AMS gateway into binary for merging into the current message on the phone. The response from the remote server must have content type "application/xml" and be wrapped in a "remoteLoadResponse" element.
  8. The data is merged with the current message on the phone and the screen refreshed. Data from the response will replace any existing data in the message.

Verifying Hashed Auth Keys

The general process used to verify the hashed value of the auth key is:

  1. Get the hash size in bytes for the algorithm used (SHA256 by default)
  2. Decode the auth key from Base64
  3. Extract the salt
  4. Compute the hash of the auth key using the salt
  5. Compare the generated hash with the one provided in the request

The general process used to compute the hashed value of the auth key is:

  1. Generate a random salt of any size, or use one provided
  2. Convert your auth key into bytes using UTF8 encoding
  3. Combine your encoded key with your salt
  4. Hash the combined result using SHA256 algorithm
  5. Combine your hash result with your salt
  6. Encode the combined hash and salt with Base64 encoding
.Net Sample

This is a basic sample outlining the above process in C# targeting .Net 3.5. It is only for illustration and is not suitable for production use.

Java Sample

This is a basic sample outlining the above process in Java. It is only for illustration and is not suitable for production use. The Apache Commons Lang and Codec libraries are used.

  • No labels