We've been told that the MML Definition documentation
will be publicly available on the usps.com
website soon. In the meantime, however, you can
request a copy from Nora Taylor at USPS HQ in
Washington DC.
Since the MML interface to the MOL system is relatively new, obtaining the MML Definition directly from the USPS will give them a better understanding of who is using MML, for what types of applications, what their needs are, etc.
Yes, you do. The staging system and the production system do not share the same authentication information. You must register for each system separately. The MML documentation (see above for how to obtain it from the USPS) addresses this.
We chose tDOM primarily because of its speed, and
because it can be compiled as a .so
shared
library for AOLserver.
TclDOM support will be added if/when requested.
The XML response from the MOL system (currently) is not always well-formed XML and most XML parsers will complain if the XML isn't massaged before hand. Specific issues we've noted are:
If an attribute value in an MML response contains a
quotation mark, rather than being escaped using an XML
entity ("
) it is escaped using
a backslash (\"
).
The above happens with single quotes too, though it's not as often an issue, as quotation marks are typically used to enclose the attribute value.
The <data>
element contains a single
CDATA section of arbitrary binary data. The binary
data may contain the literal string ]]>
which will incorrectly signal the end of the CDATA
section.
Additionally, the XML specification disallows ASCII control characters. It is easy to generate this malformed XML (and the MML parser accepts it happily), but when attempting to parse MML results the parser correctly complains. We get around this by pre-processing the CDATA section before handing things off to the parser.
We've suggested that a future revision of MML
support an attribute on the <data>
element specifying an encoding type (such
as base-64).
The Mail Management Language Definition has several example exchanges of MML requests & responses. Here are several of those examples translated into TclMML:
package require TclMML
mml::connect -staging mml username password
# TclMML version of "MML example of uploading a document"
# cf. "USPS Mail Management Language Definition," 8 Oct 2002, page 39
set inline_postscript {%!PS
initgraphics /Helvetica findfont 18 scalefont setfont
72 600 moveto (Thank you for using Mailing Online, and using the MML) dup show
72 580 moveto (standard for your printing and mailing needs.) dup show
exch = =
showpage}
set doc_id [mml upload document -data $inline_postscript "My Document"]
# TclMML version of "MML example of uploading a maillist"
# cf. "USPS Mail Management Language Definition," 8 Oct 2002, page 40-41
set addresses ""
append addresses NAME \t ADDRESS \t CITY \t STATE \t ZIP \n
append addresses USPS \t \
"475 L'Enfant Plz SW RM 5412" \t \
Washington \t DC \t 20260-4410
set mappings [list fullname NAME \
addressline1 ADDRESS \
city CITY \
state STATE \
postcode ZIP]
set ml_id [mml upload mailing -data $addresses \
-mappings $mappings \
-keep_all "My Mail List"]
# TclMML version of "MML example of submitting and paying for an order"
# cf. "USPS Mail Management Language Definition," 8 Oct 2002, page 42-43
set ra_id [mml upload return_address -fullname "Baesystems" \
-address1 "11400 Commerce Park Dr" \
-city Reston \
-state VA \
-zipcode 20191 "Example Return Addr"]
set order_id [mml upload order -document $doc_id \
-mailing_list $ml_id \
-return_address $ra_id \
-color "Red Spot Color" \
-cc_type Visa \
-cc_number xxxxxxxxxxxxxxxx \
-cc_month February \
-cc_year 2003]
set cost [mml order details $order_id total_cost]