TransMaster handles the processing of credit card transactions for FlyByNight, Inc. Their current product relies on a dedicated phone line and sockets to communicate the credit card transaction. They too are getting web enabled and with the next release of their software product, they will have an interface that will use XML-RPC over HTTPS. This will allow customers to eliminate the cost of a dedicated line by using the Internet to communicate. The next release is already in beta, so it is sufficient to say that the new Travel system can design for the new release.
XML-RPC is a Remote Procedure Calling protocol that works over the Internet. An XML-RPC message is an HTTP-POST request. The body of the request is in XML. A procedure executes on the server and the value it returns is also formatted in XML. Procedure parameters can be scalars, numbers, strings, dates, etc.; and can also be complex record and list structures.
Here is an example XML-RPC request:
The request is in XML, a single <methodCall> structure. The <methodCall> must contain a <methodName> sub-item, a string, containing the name of the method to be called. The string may only contain identifier characters, upper and lower-case A-Z, the numeric characters, 0-9, underscore, dot, colon and slash. It's entirely up to the server to decide how to interpret the characters in a methodName. For example, the methodName could be the name of a file containing a script that executes on an incoming request. It could be the name of a cell in a database table. Or it could be a path to a file contained within a hierarchy of folders and files. If the procedure call has parameters, the <methodCall> must contain a <params> sub-item. The <params> sub-item can contain any number of <param>s, each of which has a <value>.
<value>s can be scalars, type is indicated by nesting the value inside one of the tags listed in this table:
|
Tag |
Type |
Example |
|
<i4> or <int> |
Four byte signed integer |
12 or -12 |
|
<boolean> |
0 (false) or 1 (true) |
1 |
|
<string> |
ASCII string |
Hello World |
|
<double> |
Double-precision signed floating point number |
12.214 or -54.12 |
|
<dateTime.iso8601> |
Date/Time |
19991025T14:43:10 |
|
<base64> |
Base64-encoded binary |
W91IGNhbid0IHJlYWQgdGhpcyE= |
If no type is indicated, the type is string.
A value can also be of type <struct>.
A <struct> contains <member>s and each <member> contains a <name> and a <value>.
Here's an example of a two-element <struct>:
<struct>
<member>
<name>lowerBound</name>
<value><i4>18</i4></value>
</member>
<member>
<name>upperBound</name>
<value><i4>139</i4></value>
</member>
</struct>
<struct>s can be recursive, any <value> may contain a <struct> or any other type, including an <array>, described below.
A value can also be of type <array>. An <array> contains a single <data> element, which can contain any number of <value>s.
Here's an example of a four-element array:
<array>
<data>
<value><i4>12</i4></value>
<value><string>Egypt</string></value>
<value><boolean>0</boolean></value>
<value><i4>-31</i4></value>
</data>
</array>
<array> elements do not have names. You can mix types as the example above illustrates. <arrays>s can be recursive, any value may contain an <array> or any other type, including a <struct>, described above.
Here is the XML-RPC request to authorize a credit card transaction:
<?xml version="1.0"?>
<methodCall>
<methodName>AuthorizeTransaction</methodName>
<params>
<param>
<struct>
<member>
<name>MerchantID</name>
<value><string>1234</string></value>
</member>
<member>
<name>TransactionIdentifier</name>
<value><int>101</int></value>
</member>
<member>
<name>CreditCardNumber</name>
<value><base64>JfdK3s3392LL</base64></value>
</member>
<member>
<name>PurchaseAmount</name>
<value><double>52.34</double></value> // Amount
</member>
</struct>
</param>
</params>
</methodCall>
The response from TransMaster will not be using the XML-RPC response format, but instead, will be sending back an XML stream of the object(s) requested. For example, the request is made for a credit card authorization using the XML-RPC in the above example request. The response would look something like:
<transaction>
<identifier>101</identifier>
<result>authorized</result>
</transaction>
© Copyright 1998-99 UserLand Software. All Rights Reserved.
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and these paragraphs are included on all such copies and derivative works.
This document may not be modified in any way, such as by removing the copyright notice or references to UserLand or other organizations. Further, while these copyright restrictions apply to the written XML-RPC specification, no claim of ownership is made by UserLand to the protocol it describes. Any party may, for commercial or non-commercial purposes, implement this protocol without royalty or license fee to UserLand. The limited permissions granted herein are perpetual and will not be revoked by UserLand or its successors or assigns.
This document and the information contained herein is provided on an "AS IS" basis and USERLAND DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.