C XMLGetting Started
C XMLGetting Started
2020-10-31
1 Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .6
1.1 Audience and Prerequisites. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.2 Typography. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Introduction to cXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1 cXML, an XML Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2 cXML Capabilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8
Catalogs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
PunchOut. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Purchase Orders. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11
2.3 Types of Applications that Use cXML. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12
2.4 Content Delivery Strategy. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.5 cXML DTDs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
2.6 Profile Transaction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
2.7 Service Status Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16
2.8 XML Utilities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3 cXML Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1 Protocol Specification. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Request-Response Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
cXML Conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
cXML Document. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Wrapping Layers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Attachments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
cXML Envelope. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Header. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Request. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Response. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
One-Way (Asynchronous) Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Message. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Transport Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Service Status Response. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.2 Basic Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Type Entities. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Base Elements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6 Revision History. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
IMPORTANT: PLEASE CAREFULLY READ THIS cXML LICENSE AGREEMENT (“LICENSE”) BEFORE USING THE
cXML SPECIFICATION (“SPECIFICATION”). BY USING THE SPECIFICATION, YOU AGREE TO BE BOUND BY
THE TERMS OF THIS LICENSE. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE, DO NOT USE OR
ACCESS THE SPECIFICATION. Licensor may publish new versions (including revisions) of this Agreement from
time to time on the cXML site (www.cxml.org). The rights granted under this license with respect to the
Specification are subject to the version of the Agreement in effect at the time it was downloaded or accessed
by you.
1. Openness. cXML is designed and intended to be an open standard to facilitate electronic commerce. You
are welcome to use and adopt this standard, and to submit comments, recommendations, and
suggestions to cXML.org. Once submitted, your comments go through an approval process - and your
comments may ultimately be incorporated into cXML.
2. License. Subject to the terms and conditions herein, Licensor hereby grants to you a perpetual,
nonexclusive, royalty-free, worldwide right and license to use the Specification under the Licensor
intellectual property necessary to implement the Specification to (a) use, copy, publish, and distribute
(including but not limited to distribution as part of a separate computer program) the unmodified
Specification, and (b) to implement and use the Specification, including the cXML tags and schema
guidelines included in the Specification for the purpose of creating, distributing, selling or otherwise
transferring computer programs that adhere to such guidelines. If you use, publish, or distribute the
unmodified Specification, you may call it “cXML”.
3. Restrictions. Your rights under this License will terminate automatically without notice from Licensor if you
fail to comply with any terms of this License.
4. Licensor expressly reserves all other rights it may have in the material and subject matter of the
Specification, and you acknowledge and agree that Licensor owns all right, title, and interest in and to the
Specification, however, Licensor does not own the computer programs or related documentation you
create, nor does Licensor own the underlying XML or non-Ariba intellectual property from which cXML has
been derived. You agree to not assert any intellectual property rights that would be necessarily infringed by
implementation or other use of the Specification against Licensor or any other entity with respect to such
implementation or other use of the Specification; provided that your agreement to not assert shall cease to
apply to any entity including Licensor (except where Licensor or another entity is asserting intellectual
property rights against you as part of an assertion that you have breached this Agreement) that asserts
against you that its intellectual property rights are infringed by your implementation or other use of the
Specification. If you publish, copy or distribute the Specification, then this License must be attached. If you
submit any comments or suggestions to Licensor, and Licensor modifies the Specification based on your
input, Licensor shall own the modified version of the Specification.
5. No Warranty. YOU ACKNOWLEDGE AND AGREE THAT ANY USE OF THE SPECIFICATION BY YOU IS AT
YOUR OWN RISK. THE SPECIFICATION IS PROVIDED FOR USE “AS IS” WITHOUT WARRANTY OF ANY
KIND. LICENSOR AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES OF ANY KIND, INCLUDING BUT NOT
LIMITED TO ANY EXPRESS WARRANTIES, STATUTORY WARRANTIES, AND ANY IMPLIED WARRANTIES
OF: MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMNT. YOUR SOLE
AND EXCLUSIVE REMEDY RELATING TO YOUR USE OF THE SPECIFICATION SHALL BE TO DISCONTINUE
USING THE SPECIFICATION.
6. Limitation of Liability. TO THE MAXIMUM EXTENT PERMITTED BY LAW, UNDER NO CIRCUMSTANCES
SHALL LICENSOR BE LIABLE FOR ANY DAMAGES WHATSOEVER RELATING TO THIS LICENSE OR YOUR
7-19-04
This document describes how to use cXML (commerce eXtensible Markup Language) for communication of
data related to electronic commerce.
Typography [page 6]
This document is intended for application developers who design cXML-enabled applications.
Readers should have a working knowledge of e-commerce concepts, the HTTP Internet communication
standard, and XML format.
This document does not describe how to use specific procurement applications or network hubs.
1.2 Typography
cXML elements and attributes are denoted with a monotype font. cXML element and attribute names are case-
sensitive. Both are a combination of lower and uppercase, with elements beginning with an uppercase letter,
and attributes beginning with a lowercase letter. For example, MyElement is a cXML element, and
myAttribute is a cXML attribute.
The following table describes the typographic conventions used in this book:
AaBbCc123 The names of user interface controls, me Choose Edit from the File menu.
nus, and menu items
This section introduces cXML (commerce eXtensible Markup Language) for electronic-commerce
transactions.
XML (eXtensible Markup Language) is a meta-markup language used to create syntaxes for languages. It is
also a standard for passing data between applications, particularly those that communicate across the
Internet.
XML documents contain data in the form of tag/value pairs, for example:
<DeliverTo>Joe Smith</DeliverTo>
XML has a structure similar to HTML (HyperText Markup Language), which is an implementation of SGML,
XML’s parent meta language. Applications can extract and use data from XML documents more easily than
from HTML documents, however, because XML data is tagged according to its purpose. XML contains only
data, while HTML contains both data and presentation information.
Each cXML document is constructed based on XML Document Type Definitions (DTDs). Acting as templates,
DTDs define the content model of a cXML document, for example, the valid order and nesting of elements, and
the data types of attributes.
The DTDs for cXML are files available on the www.cXML.org website.
cXML allows buying organizations, suppliers, service providers, and intermediaries to communicate using a
single, standard, open language.
cXML transactions consist of documents, which are simple text files containing values enclosed by predefined
tags. Most types of cXML documents are analogous to hardcopy documents traditionally used in business.
● Catalogs [page 9]
● PunchOut [page 10]
● Purchase Orders [page 11]
2.2.1 Catalogs
Catalogs are files that convey product and service content to buying organizations. They describe the products
and services offered by a supplier and their prices, and they are the main communication channel from
suppliers to their buyers.
Suppliers create catalogs so that organizations that use procurement applications can see their product and
service offerings and buy from them. Procurement applications read catalogs and store them internally in their
databases. After a buying organization approves a catalog, that content is visible to users, who can choose
items and add them to purchase requisitions.
Suppliers can create catalogs for any product or service, regardless of how it is measured, priced, or delivered.
For each item in a catalog, basic information is required, and optional information enables advanced catalog
features, such as multi-language descriptions.
Procurement PunchOut
Procurement PunchOut gives suppliers an alternative to static catalog files. PunchOut sites are live, interactive
catalogs running on a website.
Suppliers that have e-commerce websites can modify them to support PunchOut. PunchOut sites
communicate with procurement systems over the Internet by using cXML.
For PunchOut sites, procurement applications display a button instead of product or pricing details. When
users click this button, their Web browsers display pages from the supplier’s local website. Depending on how
the supplier implements these pages, users can browse product options, specify configurations, and select
delivery methods. When users are done selecting items, they click a button that returns the order information
to the procurement application. The fully configured products and their prices appear within users’ purchase
requisitions.
The following diagram shows an interactive PunchOut session between a user and a supplier web site.
PunchOut Chaining
PunchOut chaining is Procurement PunchOut that involves more than one PunchOut. cXML Path Routing
enables this functionality.
cXML Path Routing allows the order and other subsequent messages to return to the marketplaces and
suppliers involved in producing the quote. Path Routing notifies all parties about the final order, and any
subsequent PunchOut specifies to the procurement application how to split orders on behalf of the
marketplace.
Provider PunchOut
Provider PunchOut enables applications to punch out to a remote applications that supply services to the
originating application, such as credit card validation, user authentication, or self-registration.
cXML is better for communicating purchase orders than other formats (such as ANSI X12 EDI 850), because it
is flexible, inexpensive to implement, and it supports the widest array of data and attachments.
Any e-commerce application can use cXML. Buying organizations, vertical and horizontal buying communities,
suppliers, and application vendors currently use cXML. The following subsections describe the main types of
applications that currently use cXML.
Procurement Applications
Procurement applications, such as SAP Ariba Buying, SAP Ariba Buying and Invoicing, and Ariba Buyer, use
cXML for external transactions.
These applications allow communities of users to buy contract products and services from vendors approved
by their purchasing managers. Managers in the communities first approve requested purchases, and approved
purchase orders are transmitted to suppliers through several possible channels, including cXML over the
Internet.
Network hubs, such as Ariba Network, are Web-based services for connecting buyers and suppliers. These Web
services provide features such as catalog validation and versioning, catalog publishing and subscription,
automated purchase order routing, and purchase order history.
Network hubs can act as intermediaries that authenticate and route requests and responses to and from
diverse organizations. Communication between these organizations can occur entirely through cXML over the
Internet.
PunchOut Catalogs
As described in the previous section, PunchOut catalogs are interactive catalogs, available at supplier websites.
PunchOut catalogs are made possible by Web server applications, written in a programming language such as
ASP (Active Server Pages), JavaScript, or CGI (Common Gateway Interface), that manage buyers’ PunchOut
sessions.
PunchOut catalogs accept PunchOut requests from procurement applications, identify the buying
organization, and display the appropriate products and prices in HTML format. Users then select items,
configure them, and select options if appropriate.
At the end of the PunchOut session, the PunchOut site sends descriptions of the users’ selections, in cXML
format, to the procurement applications.
Order-Receiving Systems
Order-receiving systems are applications at supplier sites that accept and process purchase orders sent by
buying organizations. Order-receiving systems can be any automated system, such as inventory management
systems, order-fulfillment systems, or order-processing systems.
Because it is simple to extract information from cXML purchase orders, it is relatively easy to create the
adapters that enable existing order-receiving systems to accept them.
Procurement applications present product and service content to users. Suppliers want to control the way their
buyers view their products or services, because presentation is critical to their sales process. Buying
organizations want to make content easily accessible and searchable to ensure high contract compliance.
Buying organizations and suppliers can choose from multiple methods for delivering product and service
content. The particular method to use is determined by agreement between a buying organization and a
supplier, and the nature of the products or services traded.
Services, Content has highly variable attributes PunchOut to an electronic form at a sup
Printed Materials plier site
Buying organizations can either store content locally within the organization, or they can access it remotely on
the Internet through PunchOut. cXML catalogs support both storage strategies.
As this table indicates, PunchOut offers a flexible framework upon which suppliers, depending on their
commodity or buyer, can provide customized content. The objective of this content strategy is to allow buyers
and suppliers to exchange catalog data by the method that makes the most sense.
Because cXML is an XML language, it is thoroughly defined by a set of Document Type Definitions (DTDs).
These DTDs are text files that describe the precise syntax and order of cXML elements. DTDs enable
applications to validate the cXML they read or write.
The header of each cXML document contains the URL to the DTD that defines the document. cXML
applications can retrieve the DTD and use it to validate the document.
For the most robust transaction handling, validate all cXML documents received. If you detect errors, issue the
appropriate error code so the sender can retransmit. cXML applications are not required to validate cXML
documents received, although it is recommended. However, all cXML documents must be valid and must refer
to the cXML DTDs described in the following section.
DTDs for all versions of cXML are available on cXML.org. The various kinds of cXML documents are defined in
multiple DTDs to reduce DTD size, which enables faster validation in some parsers.
Invoice http://xml.cXML.org/schemas/cXML/version/InvoiceDetail.dtd
Contracts http://xml.cXML.org/schemas/cXML/version/Contract.dtd
Logistics http://xml.cXML.org/schemas/cXML/version/Logistics.dtd
cXML applications use these DTDs to validate all incoming and outgoing documents.
Caching DTDs
For best performance, cXML applications should cache DTDs locally. After cXML DTD files are published, they
never change, so you can cache them indefinitely. (Each new version of the DTDs has a new URL.) When cXML
applications parse a cXML document, they should look at the SYSTEM identifier in the document header and
retrieve that DTD if it has not already been stored locally.
Caching DTDs locally offers the advantages of faster document validation and less dependence on the
cXML.org site.
In some environments, cXML applications might not be allowed to automatically retrieve DTDs as they receive
new documents. In these environments, you must manually retrieve the DTDs, store them locally, and instruct
your applications to look for them locally, not at cXML.org. However, generated cXML documents must point to
the DTDs at cXML.org, not the local DTDs.
The Profile transaction communicates basic information about what transactions a particular cXML server can
receive. All cXML servers must support this transaction. It is intended for backend integrations between
applications, making the capabilities of cXML servers available to client systems.
This transaction consists of two documents, ProfileRequest and ProfileResponse. Together, they
retrieve server capabilities, including supported cXML version, supported transactions, and options to those
transactions.
Note
All cXML 1.1 and higher servers must accept the Profile transaction.
The ProfileRequest document has no content. It simply routes to the specified cXML server.
ProfileResponse
The server responds with a ProfileResponse document, which lists the cXML transactions it supports, their
locations, and any named options with a string value.
A response with a status code of 200 from an URL that accepts POSTed cXML is up and running. When an
HTTP GET is sent to a service location, the service responds with a valid, dynamically generated cXML
Response document. A service can be any HTTP URL at which cXML Request documents are received.
Utilities for editing and validating XML files are available free and for purchase on the Web. The following
describes a few of these utilities:
● Internet Explorer from Microsoft. An XML-aware Web browser that can validate XML files against DTDs.
www.microsoft.com/windows/ie/default.htm
● Turbo XML from TIBCO Software. An Integrated Development Environment (IDE) for creating, validating,
converting and managing XML assets.
www.tibco.com/software/metadata/turboxml.jsp
● XML Spy from Altova. A tool for maintaining DTDs and XML files with a grid, source and browser view.
www.altova.com
● XMLwriter from Wattle Software. A graphical XML authoring tool designed to manage XML projects.
www.xmlwriter.net
● www.xml.com
● http://www.ibm.com/developerworks/xml/
This section describes the basic protocol and data formats of cXML. It contains information needed to
implement all transactions.
There are two communication models for cXML transactions: Request-Response and One-Way. Because these
two models strictly specify the operations, they enable simple implementation. Both models are required,
because there are situations when one model would not be appropriate.
Request-Response transactions can be performed only over an HTTP or HTTPS connection. The following
figure illustrates the steps in a Request-Response interaction between parties A and B:
1. Site A initiates an HTTP/1.x connection with Site B on a predetermined URL that represents Site B’s
address.
To simplify the work in the above steps, cXML documents are divided into two distinct parts:
Both of these elements are carried in a parent envelope element. The following example shows the structure of
a cXML Request document:
<cXML>
<Header>
Header information
</Header>
<Request>
Request information
</Request>
</cXML>
<cXML>
<Response>
Response information
</Response>
</cXML>
The Response structure does not use a Header element. It is not necessary, because the Response always
travels in the same HTTP connection as the Request.
cXML uses elements to describe discrete items, which are properties in traditional business documents.
Elements also describe information with obvious subdivisions and relationships between those subdivisions,
such as an addresses, which are composed of street, city, and country.
If optional elements have no content (they are null), leave them out entirely. Avoid empty or whitespace
elements, because missing values can affect some parsers.
In DTD files and in this document, symbols are used to indicate how many times an element can occur in a
transaction. A ‘+’ means the element can occur one or more times, a ‘?’ means the element can occur 0 or
once, and a ‘*’ means the element can occur 0 or more times.
The cXML element is the body of a cXML document. A document might begin as follows:
The first characters in cXML documents must be <? or <!. Documents must not start with white space or tabs.
For example, the HTML form that contains a PunchOutOrderMessage document must not insert any
character between the opening quote and the left angle bracket.
The second line in cXML documents must contain the DOCTYPE document type declaration. This is the only
external entity that can appear in cXML documents. This line references the cXML DTD.
cXML documents can have any one of the following top-level elements: cXML, Supplier, Contract, and
Index. The cXML element is for “transactional” data. The other elements describe static content.
Related Information
cXML documents are usually transmitted through HTTP with the HTTP header specifying a MIME
(Multipurpose Internet Mail Extensions) media type of text/xml and a charset parameter matching the
encoding in the cXML document.
Because HTTP is eight-bit clean, any character encoding supported by the receiving parser can be used
without a content-transfer encoding such as base64 or quoted-printable. All XML parsers support the UTF-8
Note
According to IETF RFC 2376 “XML Media Types,” the MIME charset parameter overrides any encoding
specified in the XML declaration. Further, the default encoding for the text/xml media type is us-ascii,
not UTF-8 as mentioned in Section 4.3.3 of the XML Specification. For clarity, cXML documents should
include an explicit encoding in the XML declaration. MIME envelopes should use a matching charset
parameter for the text/xml. You can also use the application/xml media type, which does not override
the XML declaration or affect the recipient's decoding notes, and which does not require the charset
parameter.
An HTTP transmission of a cXML document might include the following MIME and HTTP headers:
3.1.5 Attachments
The cXML protocol supports the attachment of external files of any type to cXML documents. For example,
buyers sometimes need to clarify purchase orders with supporting memos, drawings, or faxes. Another
example is the CatalogUploadRequest document, which includes catalog files as attachments.
Files referenced by cXML documents can reside either on a server accessible by the receiver or within an
envelope that also includes the cXML documents themselves. To attach external files to a cXML document in a
single envelope, use Multipurpose Internet Mail Extensions (MIME). The cXML document contains references
to external parts sent within a multipart MIME envelope.
Including Attachments
A cXML requirement for this envelope (over the requirements described in IETF RFC 2046 “Multipurpose
Internet Mail Extensions Part Two: Media Types”) is the inclusion of Content-ID headers with each attached
file.
The contained URL must begin with cid:, which is the identifier for the referenced attachment within the
larger transmission. The cid: identifier must match the Content-ID header of one (and only one) part of the
MIME transmission containing the document being forwarded.
The following example shows the required skeleton of a cXML document with an attached JPEG image (without
the HTTP headers shown above):
This skeleton is also all that a receiving MIME parser must be able to process. Applications that make use of the
media type described in RFC 2387 “The MIME Multipart/Related Content-type” will get much more information
if the skeleton is enhanced:
Receiving MIME parsers that do not understand the multipart/related media type must treat the two
examples above identically. Each part of the MIME transmission can additionally have a Content-transfer-
encoding and use that encoding. This addition is not necessary for HTTP transmission. Content-description
and Content-disposition headers are optional within the cXML protocol, although they provide useful
documentation.
Attachment Examples
Surround IDs in Content-ID or Content-Type headers with angle brackets (< >), but omit these brackets
when referring to IDs in URL elements. Similarly, prepend message IDs with cid: in URL elements, but not in
MIME headers.
Special characters in cid URLs must be hex encoded (in %hh format).
Use the Attachment element when attaching text files, PDFs, images, or other such documents to a cXML
document. When attaching another cXML document, use cXMLAttachment, regardless of whether that cXML
document contains attachments itself. The cXMLAttachment element serves to alert the receiving system
that additional cXML processing might be required to handle the attachment.
The following example shows a CopyRequest forwarding a cXML document with attachments using
cXMLAttachment.
For more information about the MIME standard, see the following websites:
● www.hunnysoft.com/mime
The cXML element is the root of cXML documents, and it contains all other elements. The cXML element is
present in every cXML transaction. The following example shows a fully specified cXML element:
<cXML xml:lang="en-US"
payloadID=1234567.4567.5678@buyer.com
timestamp="1999-03-31T18:39:09-08:00">
Attribute Description
version This attribute was deprecated in cXML 1.2.007; do not use it in new cXML documents.
(deprecated)
Specifies the version of the cXML protocol. A validating XML parser could also determine
the version attribute from the referenced DTD.
Because this version number also appears in the SYSTEM identifier in the cXML docu
ment, you should omit this attribute.
xml:lang The locale used for all free text sent within this document. The receiver should reply or dis
play information in the same or a similar locale. For example, a client specifying
xml:lang=“en-UK” in a request might receive “en” data in return. Specify the most
descriptive and specific locale possible.
payloadID A unique number with respect to space and time, used for logging purposes to identify
(required) documents that might have been lost or had problems. This value should not change for
retry attempts.
timestamp The date and time the message was sent, in ISO 8601 format. This value should not
(required) change for retry attempts.
signatureVersion If present, implies that the document is digitally signed, that is, that the document con
tains one or more valid ds:Signature elements immediately following the Request,
Response, or Message element. The only valid value for the attribute is 1.0; other val
ues are reserved for future use.
Related Information
The xml:lang attribute also appears with most free text elements (such as Description and Comments).
While the XML specification allows the locale for an element to default to that specified for any parent element,
such defaults result in inefficient queries of the document tree. cXML attempts to keep the locale identifiers
together with the affected strings. The most descriptive and specific locale known should be specified in this
attribute.
The xml:lang attributes appearing throughout the cXML protocol have no effect on formatted data such as
numbers, dates, and times. As described for the timestamp attribute in the following section, for the
timestamp attribute, such discrete values are formatted according to their data types. Longer strings (and
referenced Web pages) not intended for machine processing might contain a locale-specific numeric or date
format that matches a nearby xml:lang attribute.
The timestamp attribute, and all other dates and times in cXML, must be formatted in the restricted subset of
ISO 8601. This is described in the Word Wide Web Consortium (W3C) Note entitled “Date and Time Formats”
available at
www.w3.org/TR/NOTE-datetime-970915.html.
Timestamps should include a complete date plus hours, minutes, and seconds. Fractions of a second are
optional. This protocol requires times expressed in local time with a time-zone offset from UTC (Coordinated
Universal Time, also known as Greenwich Mean Time). The “Z” time zone designator is not allowed.
For example, 2015-04-14T13:36:00-08:00 corresponds to April 14, 2015, 1:36 p.m., U.S. Pacific Standard
Time.
Note
Although the timestamp attribute is required by the cXML DTD, validation of the value's format depends
on your application.
Further references for the date, time, and other data type formats used by cXML are:
In cXML, as in XML, not all characters can be typed from the keyboard, such as the registered trademark
symbol (®). Others, such as < and &, have special meaning to XML. These characters must be encoded using
character entities.
Entity Character
< <
> >
& &
" “
' ‘
For characters outside of the encoding you use, use the Unicode number of the character (decimal or
hexadecimal), preceded by pound (#). For example, ® and ® represent a registered trademark
symbol, ®.
For example,
could be encoded as
Single (') or double (") quotation marks must be escaped only within attribute values that are quoted using that
delimiter. It is recommended that you use only single quotes to delimit attributes, unless the content will never
contain quotes.
<!-- Recommendation for cXML-urlencoding: Uses double quotes to delimit the -->
<!-- field value and single quotes for the contained attributes. -->
<Input type="Hidden" name="cXML-urlencoded" value="<?xml version='1.0'
encoding='UTF-8'?>
<!DOCTYPE Money SYSTEM 'SpecialChars.dtd'>
<Money
alternateAmount='MoneyalternateAmount='&#174;&#xAE;&apos;"&#3
4;
&quot;&amp;&lt;>&gt;'>&#174;&#xAE;'&apos;
"&#34;&quot;&amp;&lt;&gt;&gt;'</Money>">
<!-- Best choice: Base64 encode the value. Don't have to worry about what -->
<!-- the browser interprets. -->
<Input type="Hidden" name="cXML-
base64"value="PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4K
PCFET0NUWVBFIE1vbmV5IFNZU1RFTSAnU3BlY2lhbENoYXJzLmR0ZCc+CjxNb
25leSBhbHRlcm5hdGVBbW91bnQ9JyYjMTc0OyYjeEFFOyZhcG9zOyImIzM0OyZxd
W90OyZhbXA7Jmx0Oz4mZ3Q7Jz4KJiMxNzQ7JiN4QUU7JyZhcG9zOyImIzM0OyZx
dW90OyZhbXA7Jmx0Oz4mZ3Q7PC9Nb25leT4K">
The preceding examples illustrate alternatives for encoding the cXML-urlencoded field. They avoid XML
escaping a few characters, such as angle brackets, that are not special to XML in all contexts. A direct
implementation of the previous steps would result in an HTML field such as:
3.1.7 Header
The Header element contains addressing and authentication information. The Header element is the same
regardless of the specific Request or Response within the body of the cXML message. Applications need the
requestor's identity, but not validation that the information provided for identity is correct.
<Header>
The From and To elements are synonymous with From and To in SMTP mail messages; they are the logical
source and destination of the messages. Sender is the party that opens the HTTP connection and sends the
cXML document.
Sender contains the Credential element, which allows the receiving party to authenticate the sending party.
This credential allows strong authentication without requiring a public-key end-to-end digital certificate
infrastructure. Only a user name and password need to be issued by the receiving party to allow the sending
party to perform Requests.
When the document is initially sent, Sender and From are the same, However, if the cXML document travels
through network hubs, the Sender element changes to indicate current sending party.
3.1.7.1 From
3.1.7.2 To
3.1.7.3 Sender
This element allows the receiving party to identify and authenticate the party that opened the HTTP
connection. It contains a stronger authentication Credential than the ones in the From or To elements,
because the receiving party must authenticate who is asking it to perform work.
A textual string representing the UserAgent who is conducting the cXML conversation. This should be a
unique per-product string, and ideally, per-version. Analogous to UserAgent for HTTP conversations.
3.1.7.5 Credential
Attribute Description
domain Specifies the type of credential. This attribute allows documents to contain multiple types
(required) of credentials for multiple authentication domains.
For messages sent on Ariba Network, for instance, the domain can be
AribaNetworkUserId to indicate an email address, DUNS for a D-U-N-S number, or
NetworkId for a preassigned ID.
type Requests to or from a marketplace identify both the marketplace and the member com
pany in From or To Credential elements. In this case, the credential for the market
place uses the type attribute, which is set to the value “marketplace”.
SharedSecret
The SharedSecret element is used when the Sender has a password that the requester recognizes.
Note
Do not use authentication elements in documents sent through one-way communication. One-way
transport routes through users’ browsers, so users would be able to see the document source, including
Credential elements.
CredentialMac
The CredentialMac element is used for the Message Authentication Code (MAC) authentication method.
This authentication method is used in situations where the sender must prove to the receiver that it has been
authenticated by shared secret by a trusted third party. For example, a direct PunchOut request can travel
directly from a buyer to a supplier without going through a network hub, because it contains a MAC (generated
by the network hub) that allows the supplier to authenticate it.
The receiver computes the MAC using the same inputs as the trusted third party and compares it with the MAC
received in the cXML document. If the two values match, the document is authentic.
To learn how to compute the MAC value, see Message Authentication Code (MAC) [page 45].
Attribute Description
type Identifies the data being authenticated and the method in which it is formatted for authen
(required) tication. The only supported value is "FromSenderCredentials".
algorithm Identifies for the MAC algorithm used on the data. The only supported value is “HMAC-
(required) SHA1-96”.
creationDate Specifies the date and time the MAC was generated.
(required)
expirationDate Specifies the date and time after which this MAC is no longer valid. Receivers must reject
(required) MACs that are received after the expirationDate. Receivers can optionally reject unexpired
MACs. For example, a receiver might reject MACs that are scheduled to expire in less than
an hour.
The following example shows a Credential element that contains a CredentialMac element:
<Sender>
<Credential domain=”NetworkId”>
<Identity>AN9900000100</Identity>
<CredentialMac type=”FromSenderCredentials”
algorithm=”HMAC-SHA1-96”
creationDate=”2003-01-15T08:42:46-0800”
expirationDate=”2003-01-15T11:42:46-0800”>
MnXkusp8Jj0lw3mf
</CredentialMac>
<UserAgent>Procurement Application 8.1</UserAgent>
</Credential>
</Sender>
Multiple Credentials
The From, To, and Sender elements can each optionally contain multiple Credential elements. The purpose
of supplying multiple credentials is to identify a single organization using different domains. For example, an
organization might be identified by including both a DUNS number and a NetworkId number.
The receiver should validate all credentials with domains it recognizes and it should reject the document if any
credentials with recognized domains do not match an organization it knows. It should also reject the document
if any two credentials in the same From, To, or Sender section appear to refer to different entities.
The receiver should reject the document if there are multiple credentials in a To, From, or Sender section that
use different values but use the same domain.
The From and To elements can each optionally contain a Correspondent element. Correspondent elements
are used in cases where a party or a connecting hub does not know the originating or receiving organization.
The sender, receiver, or connecting hub can use the information in the Correspondent element to identify the
unknown organization.
Attribute Description
Related Information
3.1.8 Request
Clients send requests for operations. Only one Request element is allowed for each cXML envelope element,
which simplifies the server implementations, because no de-multiplexing needs to occur when reading cXML
documents. The Request element can contain virtually any type of XML data.
● OrderRequest
● ProfileRequest
● PunchOutSetupRequest
● StatusUpdateRequest
● GetPendingRequest
● ConfirmationRequest
● ShipNoticeRequest
● ProviderSetupRequest
● PaymentRemittanceRequest
Attribute Description
deploymentMode Indicates whether the request is a test request or a production request. Allowed values are
“production” (default) or “test”.
Id This attribute can be used to call out an element and all its children as a target for a digital
signing.
3.1.9 Response
Servers send responses to inform clients of the results of operations. Because the result of some requests
might not have any data, the Response element can optionally contain nothing but a Status element. A
Response element can also contain any application-level data. During PunchOut for example, the application-
level data is contained in a PunchOutSetupResponse element.
● ProfileResponse
● PunchOutSetupResponse
● GetPendingResponse
Attribute Description
Id This attribute can be used to call out an element and all its children as a target for a digital
signing.
Related Information
3.1.9.1 Status
This element conveys the success, transient failure, or permanent failure of a request operation.
Attribute Description
code The status code of the request. For example, 200 represents a successful request. See the
(required) table of codes below.
text The text of the status. This text aids user readability in logs, and is a canonical string for
(required) the error in English.
xml:lang The language of the data in the Status element. Optional for compatibility with cXML
1.0. Might be required in future versions of cXML.
The content of the Status element can be any data needed by the requestor and should describe the error. For
a cXML 200/OK status code, there might be no data. However, for a cXML 500/Internal Server Error
status code, or other similar code, it is strongly recommended that the actual XML parse error or application
error be presented. This error allows better one-sided debugging and interoperability testing. For example:
Range Meaning
2xx Success
4xx Permanent error. Client should not retry. The error prevents the request from being accepted.
5xx Transient error. Typically a transport error. Client should retry. The recommended number of retries is
10, with a frequency of one hour. At a minimum a six hour retry window is recommended. For high prior
ity requests, such as rush orders, you might want to increase the retry frequency.
Servers should not include additional Response elements (for example, a PunchOutSetupResponse
element) unless the status code is in the cXML 200 range (for example, cXML 200/OK).
Because cXML is layered above HTTP in most cases, many errors (such as HTTP 404/Not Found) are
handled by the transport. All transport errors should be treated as transient and the client should retry, as if a
cXML 500 range status code had been received. All HTTP replies that don’t include valid cXML content,
including HTTP 404/Not found and HTTP 500/Internal Server Error status codes, are considered transport
errors. Other common transport problems include timeouts, TCP errors (such as “connection refused”),
and DNS errors (such as “host unknown”). Validation errors in parsing a Request document would normally
result in a cXML permanent error in the 400 range, preferably 406/Not Acceptable.
200 OK The server was able to execute the request or deliver it to the final recipient. The
returned Response might contain application warnings or errors: the cXML
Request itself generated no errors or warnings, however, this status does not
reflect any errors or warnings that might be generated afterward by the applica
tion itself. You will receive no further status updates, unless an error occurs dur
ing later processing.
201 Accepted The request has been accepted for forwarding by an intermediate hub, or has
been accepted by its ultimate destination and not yet been examined. You will re
ceive updates on the status of the request, if a mechanism to deliver them is
available.
204 No Content All Request information was valid and recognized. The server has no
Response data of the type requested.
211 OK Buyers can use this status code to send a broadcast message to suppliers to in
form them about any events they need to know, such as holiday schedules, pro
duction facility closure, or completion of certain activities such as planning run
completion.
280 The request has been forwarded by an intermediate hub. You will receive at least
one more status update. This status could mean that the request was delivered
to another intermediary or to the final recipient with 201 status, or that it was for
warded via a reliable non-cXML transport.
281 The request has been forwarded by an intermediate hub using an unreliable
transport (such as email). You might receive status updates; however, if you do
not received status updates, there is not necessarily a problem.
400 Bad Request Request unacceptable to the server, although it parsed correctly.
401 Unauthorized Credentials provided in the Request (the Sender element) were not recog
nized by the server.
402 Payment Required This Request must include a complete Payment element.
403 Forbidden The user has insufficient privileges to execute this Request.
406 Not Acceptable Request unacceptable to the server, likely due to a parsing failure.
409 Conflict The current state of the server or its internal data prevented the (update) opera
tion request. An identical Request is unlikely to succeed in the future, but only
after another operation has executed, if at all.
412 Precondition Failed A precondition of the Request (for example, a PunchOut session appropriate
for a PunchOutSetupRequest edit) was not met. This status normally
implies the client ignored some portion of a previous transmission from a server
(for example, the operationAllowed attribute of a
PunchOutOrderMessageHeader).
417 Expectation Failed Request implied a resource condition that was not met. One example might be
a SupplierDataRequest asking for information about a supplier unknown
to the server. This status might imply lost information at the client or server.
450 Not Implemented The server does not implement the particular Request. For example,
PunchOutSetupRequest or the requested operation might not be sup
ported. This status normally implies the client has ignored the server’s profile.
475 Signature Required The receiver is unwilling to accept the document because it does not have a digi
tal signature.
476 Signature Verification The receiver is unable to validate the signature, possibly because the document
Failed was altered in transit, or the receiver does not support one or more algorithms
used in the signature.
477 Signature Unacceptable The signature is technically valid, but is not acceptable to the receiver for some
other reason. The signature policies or certificate policies may be unacceptable,
the type of certificate used may be unacceptable, or there may be some other
problem.
500 Internal Server Error Server was unable to complete the Request.
550 Unable to reach cXML Unable to reach next cXML server to complete a transaction requiring upstream
server connections. An intermediate hub can return this code when a supplier site is un
reachable. If upstream connections complete, intermediate hubs should return
errors directly to the client.
551 Unable to forward re Unable to forward request because of supplier misconfiguration. For example, an
quest intermediate hub failed to authenticate itself to a supplier. Clients cannot rectify
this error, but this error might be resolved before the client retries.
560 Temporary server error For example, a server might be down for maintenance. The client should retry
later.
The following table lists possible status codes for catalog-upload requests:
461 Bad Commodity Code The commodity code you assigned to the catalog is invalid.
467 Publish Not Allowed You attempted to publish a catalog that was not previously published.
468 Catalog Too Large The size of the uploaded file exceeds the 4 MB limit. Zip the catalog to
compress it before uploading it.
469 Bad Catalog Extension The file name of the catalog must have .cif, .xml, or .zip extensions.
470 Catalog Has Errors The message is the status of the catalog. (HasErrors)
561 Too Many Catalogs You cannot upload more than a specific number of catalogs per hour.
562 Publish Disabled Catalog publishing is temporarily unavailable due to scheduled mainte
nance. It will be back online by the specified date and time.
563 Catalog Validating You attempted to update a catalog before validation finished on a previ
ous version of the catalog.
When receiving unrecognized codes, cXML clients must handle them according to their class. Therefore, older
clients should treat all new 2xx codes as 200 (success), 4xx codes as 400 (permanent failure), and 5xx codes
as 500 (transient error). This behavior allows for both further expansions of the cXML protocol and server-
specific codes without loss of interoperability.
Unlike Request-Response transactions, One-Way messages are not restricted to the HTTP transport. One-way
messages are for situations when an HTTP channel (a synchronous request-response type operation) is not
appropriate. The following figure shows an example of how A and B might communicate with messages instead
of the Request-Response transaction.
1. Site A formats and encodes a cXML document in a transport that Site B understands.
2. Site A sends the document using the known transport. Site A does not (and cannot) actively wait for a
response to come back from Site B.
3. Site B receives the cXML document and decodes it out of the transport stream.
4. Site B processes the document.
In the One-Way model, Site A and Site B do not have an explicit Request-Response cycle. For example, between
One-Way messages, messages from other parties might arrive and other conversations could take place.
To fully specify a one-way transaction, the transport used for the message must also be documented. For the
cXML transactions that use the one-way approach, the transport and encoding are specified. A common
example of a transaction that uses one-way is the PunchOutOrderMessage.
<cXML>
<Header>
Header information here…
</Header>
<Message>
Message information here…
</Message>
</cXML>
The Header element is treated exactly as it is in the Request-Response case. The cXML element is also
identical to the one described in cXML Envelope [page 24]. The easiest way to tell the difference between a
one-way message and a Request-Response message is the presence of a Message element (instead of a
Request or Response element). The following section discusses the Message element in more detail.
The Header element in a one-way message should not contain shared secret information in the sender
credential. Authentication is done using the BuyerCookie. This is different from Request-Response Header.
This element carries all the body level information in a cXML message. It can contain an optional Status
element, identical to that found in a Response element—it would be used in messages that are logical
responses to request messages.
Attribute Description
deploymentMode Indicates whether the request is a test request or a production request. Allowed values are
“production” (default) or “test”.
inReplyTo Specifies to which Message this Message responds. The contents of the inReplyTo
attribute would be the payloadID of a Message that was received earlier. This would
be used to construct a two-way conversation with many messages.
Id This attribute can be used to call out an element and all its children as a target for a digital
signing.
The inReplyTo attribute can also reference the payloadID of an earlier Request or Response document.
When a Request-Response transaction initiates a “conversation” through multiple one-way interactions, the
first message can include the payloadID of the most recent relevant Request or Response that went in the
other direction. For example, a Message containing a PunchOutOrderMessage might include an inReplyTo
attribute containing the payloadID of the PunchOutSetupRequest that started the PunchOut session. The
BuyerCookie included in the PunchOut documents performs a similar function to that of the inReplyTo
attribute.
Related Information
There are two commonly used transports for one-way messages: HTTP and URL-Form-Encoding. These are
just two of the well-defined transports today; more could become supported in the future.
HTTP
Procurement applications pull information using one-way HTTP communication. The one type of transaction
that uses one-way HTTP communication is GetPendingRequest.
URL-Form-Encoding enables integration between remote websites and procurement applications. It also
serves as a way to avoid requiring a listening server on the buyer’s system that is directly accessible through
the Internet. This transport is best understood by examining how the PunchOutOrderMessage transaction
works.
Form Packing
Remote websites assign each PunchOutOrderMessage document to a hidden field on the Form named cXML-
urlencoded or cXML-base64. They assign the HTML Form element a METHOD of POST and an ACTION
consisting of the URL passed in the BrowserFormPost element of the PunchOutSetupRequest. For
example:
<FORM METHOD=POST
ACTION="http://workchairs.com:1616/punchoutexit">
Additional HTML tags on the page might contain the above fragment to describe the contents of the shopping
basket in detail.
Note
When Web servers send the cXML-urlencoded field, it is not yet URL encoded. This encoding is required
only when the form is submitted by Web browsers (when users click Check Out in the above example). Web
browsers themselves meet this requirement. The Web server must HTML-encode only the field value,
escaping quotation marks and other special characters, so the form displays properly for the user.
cXML-urlencoded
The cXML-urlencoded field is URL encoded (per the HTTP specification) by the Web browser, not by the Web
server or the supplier. This is because the encoding is required only when the form is submitted by a Web
browser, such as when a user clicks Check Out in the previous example. However, the Web server must HTML-
encode the field value, escaping quotation marks and other special characters, so that the form will display
correctly.
Note
Suppliers should never URL encode the cXML-urlencoded field. This field is automatically URL-encoded by
the web browser.
For cXML-urlencoded data, the receiving parser cannot assume a charset parameter beyond the default for
media type text/xml. No character encoding information for the posted data is carried in an HTTP POST. The
receiving Web server cannot determine the encoding of the HTML page containing the hidden field. The cXML
document forwarded in this fashion must therefore use us-ascii character encoding. Any characters
(including those “URI encoded” as “%XX”) found in the XML source document must be in the “us-ascii” set.
Other Unicode symbols can be encoded using character entities in that source document.
cXML-Base64
The cXML-base64 hidden field supports international documents. cXML documents containing symbols
outside of “us-ascii” should use this field instead of the cXML-urlencoded hidden field. This alternative has
almost identical semantics, but the entire document is base64-encoded throughout transport and not HTML-
encoded to the browser or URL-encoded to the receiving Web server. Base64-encoding is described in RFC
2045 “Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies.”
Base64-encoding from the remote website through the browser and to the receiving Web server at the client
maintains the original character encoding of a cXML document. Though no charset parameter arrives with
the posted information, the decoded document (after the transfer encoding is removed) can be treated as the
Either of these hidden fields (cXML-urlencoded or cXML-base64) must appear in the data posted to the
procurement application. Though recipients should first look for cXML-base64 in the data, it is wasteful to
send both fields.
The procurement application, which previously provided the appropriate URL, receives an HTML Form POST
containing the Form data as described above. The Form POST processor would first look for the cXML-base64
variable, extract the value and base64-decode its contents. If that field does not exist in the data, the Form
POST processor would look for the cXML-urlencoded variable, extract the URL-encoded cXML message and
URL-decode it. The decoded content of the field is then processed as if it had been received through a normal
HTTP Request/Response cycle.
The implied media type of the document after decoding varies, with different possible character encodings:
● The cXML-urlencoded variable is of media type text/xml with no charset attribute. It is thus restricted to
the us-ascii character encoding. The receiving parser must ignore any encoding attribute in the XML
declaration of the cXML document because the browser might have changed the encoding.
● The cXML-base64 variable is of media type application/xml and thus might have any character
encoding (indicated by the encoding attribute of the contained XML declaration, if any). The default
character encoding is UTF-8, as for any application/xml documents.
The primary difference between this transaction and a normal Request-Response transaction is that there is no
response that can be generated, because there is no HTTP connection through which to send it.
This transaction determines whether a particular service is currently available. When an HTTP GET is sent to a
service location, the service responds with a valid, dynamically generated cXML Response document. A
service can be any HTTP URL at which cXML Request documents are received.
This combination of transport (HTTP) and protocol (cXML) levels should be used only for the case
described above.
The following entities and elements are used throughout the cXML specification. Most of the definitions listed
here are basic vocabulary with which the higher-order business documents are described. The common type
entities and the common elements representing low-level objects are defined here.
Most of these definitions are from the XML-Data note submission to the World Wide Web Consortium (W3C). A
few higher-level type entities that are also defined here are not from XML-Data.
isoLangCode
isoStateCode
An ISO 3166-2:2013 country subdivision code that identifies a state or province. It is used in conjunction with
the country codes listed in ISO 3166-1.
isoCountryCode
xmlLangCode
The recommended cXML language code format is xx[-YY[-zzz]*]? where xx is an ISO 639 Language code, YY is
an ISO 3166 Country Code and zzz is an IANA or private subcode for the language in question. Again, use of the
Country Code is always recommended. By convention, the language code is lowercase and the country code is
uppercase. This is not required for correct matching of the codes.
UnitOfMeasure
UnitOfMeasure describes how the product is packaged or shipped. It must conform to UN/CEFACT Unit of
Measure Common Codes. See www.unece.org/cefact/codesfortrade/codes_index.html.
URL
Related Information
These elements, used throughout the specification, range from generic ones such as Name and Extrinsic to
specific ones such as Money.
Money
The Money element has three possible attributes: currency, alternateAmount, alternateCurrency.
The attributes currency and alternateCurrecy must be a three-letter ISO 4217 currency code. The
content of the Money element and of the aternateAmount attribute should be a numeric value. For example:
<Money currency="USD">12.34</Money>
Note
You can optionally use commas as thousands separators. Do not use commas as decimal separators.
State
Contains the state or country subdivision identifier. Contained by the PostalAddress element. It has an
optional isoStateCode [page 41] attribute.
<State isoStateCode="US-CA">CA</State>
Country
Contains the name of the country in a location. Contained by the PostalAddress element. It has an optional
isoCountryCode [page 41] attribute.
CountryCode
Contains the International ITU dial code for the country code. It can be entered onto a telephone keypad after
the escape code to reach the country. Used by the TelephoneNumber element.
<TelephoneNumber>
<CountryCode isoCountryCode="US">1</CountryCode>
<AreaOrCityCode>800</AreaOrCityCode>
<Number>5551212</Number>
</TelephoneNumber>
Contact
The Contact element contains information about any contact important to the current transaction. For
example:
<Contact>
cXML supports alternatives to the shared secret authentication method for verifying the sender of cXML
documents.
Message Authentication Code (MAC) authentication allows the authentication of documents sent directly from
a client to a server without passing through a trusted third party (such as a network hub) for authentication.
These documents contain a credential with an authentication code that can be interpreted only by the trusted
third party and the receiving server, not by the sender.
The format of the Credential element containing the MAC is described in Credential [page 29].
The primary purpose of MACs is to convey receivers’ shared secrets without revealing them to senders. MACs
keep shared secrets secure by encoding them through a hash.
MACs are as secure as shared secrets. Senders must guard MACs as carefully as shared secrets.
Compromising either piece of information could make trading partners vulnerable.
To use MAC authentication, both the trusted third party and the receiver must be able to compute MACs.
MACs are created by an algorithm that combines data known by both the trusted third party and the receiver.
cXML specifies the use of the HMAC-SHA1 algorithm described in IETF RFC 2104, “HMAC: Keyed-Hashing for
Message Authentication”.
The HMAC-SHA1 algorithm provide the security required for cXML, and it has been formally proven to be as
secure as the underlying hash algorithm.
If a MAC is stolen, changing the sender’s shared secret has no effect. It is impractical to expect the sender to
contact the receiver out-of-band to invalidate the MAC, because they might not have an established
relationship. To address this problem, a creation date (creationDate) and an expiration date
(expirationDate) are embedded in MACs. The expiration date limits the damage that can be result from a
stolen MAC, because MACs eventually expire. The shorter the expiration period, the greater the security
afforded. Receivers must reject MACs that are received after their expiration date.
Receivers can also reject unexpired MACs based on the amount of time that has elapsed since the creation
date. For example, if a receiver receives a MAC that was created several years ago, but expires tomorrow, the
receiver might not wish to accept the MAC. This decision is left with the implementors of the receiving systems.
It is mandatory for receivers to check that the creation date is in the past and the expiration date is in the
future, and to reject it if either is not the case. However, it is optional for receivers to check whether the creation
date is too long in the past.
Receivers must not only check that MACs are valid, but also that the data authenticated by MACs is acceptable.
Specifically, receivers must validate that they wish to accept messages from the entities identified by the From
and Sender credentials.
This section describes how to compute a MAC of type="FromSenderCredentials". The inputs for this MAC
type are known only by the trusted third party and the receiver.
The trusted third party uses this computation to generate ProfileResponse Option elements and the
receiving server uses it to validate the CredentialMac element.
The MAC function takes two inputs, the data input and the secret key input:
● The data input is the UTF-8-encoded byte representation of each value listed below, in order, after
normalization, with each value terminated by a single null byte (0x00):
From/Credential@domain
From/Credential/Identity
Sender/Credential@domain
Sender/Credential/Identity
Sender/Credential/CredentialMac@creationDate
Sender/Credential/CredentialMac@expirationDate
● The secret key input is the cXML shared secret used between the receiver and the third party.
Normalize the values listed above to remove differences in case and formatting before computation:
domain Use the lowercase version of the string, unless it is known to networkid
be case sensitive, for example, “AribaNetworkUserId”. Note
that “NetworkId” and “DUNS” are not case-sensitive.
Identity Discard leading or trailing whitespace and use the lowercase an9900000100
version of the string.
The only supported MAC algorithm value is "HMAC-SHA1-96", which corresponds to the HMAC-SHA1
algorithm, which produces a 160 bit (20 byte) output, and retaining only the left-most 96 bits (12 bytes). The 12
bytes are then base-64 encoded, yielding a 16-byte character string consisting only of characters in the set [A-
Z a-z 0-9 +/].
1. Concatenate the UTF-8-encoded byte representation of the following strings, each followed by a null byte
(0x00). (The strings have been normalized as described above):
“networkid”, “an9900000100”, “networkid”, “an9900000100”,
“2003-01-15T08:42:46-08:00”, “2003-01-15T11:42:46-08:00”
The concatenation yields the following byte sequence:
6e 65 74 77 6f 72 6b 69 64 00 61 6e 39 39 30 30
30 30 30 31 30 30 00 6e 65 74 77 6f 72 6b 69 64
00 61 6e 39 39 30 30 30 30 30 31 30 30 00 32 30
30 33 2d 30 31 2d 31 35 54 30 38 3a 34 32 3a 34
36 2d 30 38 3a 30 30 00 32 30 30 33 2d 30 31 2d
31 35 54 31 31 3a 34 32 3a 34 36 2d 30 38 3a 30
30 00
2. Use HMAC-SHA1 to hash the above sequence with the receiver’s shared secret, for example,
“abracadabra” (61 62 72 61 63 61 64 61 62 72 61), which yields:
71 1e 89 a7 3e 7c 9e b8 97 11 10 cd 78 57 fd a0 94 da fd
71 1e 89 a7 3e 7c 9e b8 97 11 10 cd
cR6Jpz58nriXERDN
The trusted third party inserts the final result in ProfileResponse documents it sends to the entity that
will be the client (document sender), and the client inserts it in a CredentialMac element in all direct
communication to the server (document receiver).
4.1.5 ProfileResponse
The following cXML example shows a ProfileResponse sent from a trusted third party (such as a network
hub) to a client (such as a procurement application) so the client can send direct requests to the receiving
server.
<cXML payloadID="1234567890@bighub.com"
timestamp="2003-01-15T09:39:09-08:00" xml:lang="en-US">
<Response>
<Status code="200" text="OK"/>
<ProfileResponse>
<Option name="CredentialMac.type">FromSenderCredentials</Option>
<Option name="CredentialMac.algorithm">HMAC-SHA1-96</Option>
<Option name="CredentialMac.creationDate">2003-01-15T08:42:46
-0800</Option>
<Option name="CredentialMac.expirationDate">2003-01-15T11:42:46
-0800</Option>
<Option name="CredentialMac.value">cR6Jpz58nriXERDN</Option>
<Transaction requestName="OrderRequest">
<URL>https://service.hub.com/ANCXMLDispatcher.aw/ad/cxml</URL>
</Transaction>
<Transaction requestName="PunchOutSetupRequest">
<URL>https://service.hub.com/AN/cxml</URL>
<Option name="Direct.URL">https://bigsupplier.com/punchout</Option>
<Option name="Direct.AuthenticationMethod.CredentialMac">Yes
</Option>
<Option name="Direct.AuthenticationMethod.Certificate">Yes</Option>
</Transaction>
</ProfileResponse>
</Response>
</cXML>
4.1.6 CredentialMac
The following cXML document fragment shows an example CredentialMac element as it would be inserted
by the client in documents sent directly to the server.
<cXML>
<Header>
<To>
<Credential domain="DUNS">
<Identity>049329048</Identity>
</Credential>
</To>
<From>
<Credential domain="NetworkId">
<Identity>AN9900000100</Identity>
Related Information
The Auth transaction allows receivers to validate organizations’ credentials through a mutually trusted third
party. It should be used to authenticate received documents that do not contain either a shared secret or a
MAC.
The receiver encloses the credential of the sender (the principal) in an AuthRequest document and sends it to
the trusted third party for validation.
If the principal attempts to authenticate using a client digital certificate, the receiver includes both the
principal’s credential and information about the principal’s certificate in the AuthRequest document. (The
receiver obtains this certificate information from its Webserver or SSL/TLS implementation.)
The trusted third party receives the AuthRequest and looks up the principal’s credential to see if it is a
recognized organization. If the principal’s certificate information was included, the trusted third party makes
sure the certificate is valid and that it matches the organization associated with the credential.
If the credential (and optional certificate) authenticates, the trusted third party responds with a positive
AuthResponse that contains the validated credential. If the credential is invalid, the trusted third party
responds with an empty cXML response of status 403 (Forbidden).
The receiver can cache the results of the Auth transaction until the expiration date indicated in the
AuthResponse. During this period, if the principal presents the same credential and certificate, the receiver
need not send another AuthRequest.
The following example includes X509 certificate information, which comes from the requesting entity’s client
digital certificate.
4.2.1.1 Credential
4.2.1.2 X509Data
A container for the serial number and issuer name of the X.509 certificate.
● X509IssuerName
The distinguished name of the issuer of the X.509 certificate. The distinguished name should be a string
representation of an LDAP Distinguished Name, as described in RFC 2253. For example,
C=US, O=”Mega Data Security, Inc.”, OU=Secure Server CA
● X509SerialNumber
The serial number of the X.509 certificate.
X509SKI
X509 SubjectName
The distinguished name of the subject of the X.509 certificate. This should be a string representation of an
LDAP distinguished name, as described in RFC 2253.
X509Certificate
X509CRL
4.2.2 AuthResponse
Returns a list of valid credentials of the person entity in the AuthRequest document. Note that this response
is for successful authentications only.
Attribute Description
expirationDate Specifies the time beyond which the information contained in the AuthResponse must
be discarded. The inclusion of this attribute specifies that the receiver can cache the Au
thResponse information until the expirationDate.
Any cXML request, response, or message can be signed using World Wide Web Consortium (W3C) XML Digital
Signatures. Support for the XML Advanced Electronic Signature (XAdES) standard is also included.
Readers of this section should be familiar with electronic signature terminology and concepts such as
asymmetric key pairs, certificates, and smart cards.
An XML digital signature—which is a specific arrangement of a digital signature—is an element that contains
other information besides the cryptographic signature itself, including a list of what was signed, the signer’s
public key, and other attributes. A cXML signature is an XML digital signature of a certain form, as described
later in this chapter.
XML Advanced Electronic Signature (XAdES) provides basic authentication and integrity protection.
W3C XML signatures and XAdES have many options designed to allow for flexibility.
For information about W3C XML digital signatures, see the following resources:
● www.w3.org
● XML Signature Syntax and Processing Version 1.1
Note that signature and certificate requirements vary according to local laws and regulations. Prior to
implementing a signing system, be sure you learn the requirements of the relevant locale.
A valid cXML digital signature is not just an XML signature, but an XML signature that uses particular options,
has particular elements present, and signs (or does not sign) certain portions of the document.
Note that namespace prefix conventions are used here when referring to elements that come from other
specifications. All W3C XML Digital Signature elements use the ds prefix, and all XAdES elements use the
xades prefix.
The cXML element contains a space for the ds:Signature element after the Request, Response, or
Message element. The ds:Signature element holds information about what is being signed, one or more
signatures, and the keys used to create the signature or signatures. It also has a place to store additional
information such as XAdES extensions or attachment manifests.
The cXML element also contains a space for the signatureVersion attribute.
Attribute Description
Id This attribute can be used to call out an element and all its children as a tar
get for signing. For example, if a document contains <Request
Id="foo">, then in the digital signature <Reference URI="#foo">
will refer to the Request element and all its children. If the document is
signed, this attribute must be present.
Related Information
The cXMLSignedInfo element includes cXML-specific details about the signature, and has the following
attributes:
Attribute Description
signatureVersion Implies that the document is digitally signed, that is, that the document con
(required) tains a valid ds:Signature element immediately following the Request,
Response, or Message element. The only valid value for the attribute is
1.0; other values are reserved for future use.
Because some information from the cXML header is significant, it must be signed. To sign these attributes
from the header, repeat the information in a cXMLSignedInfo element placed within a ds:Object element.
The ds:Object must be the first ds:Object in the signature. For example:
<ds:Object>
<cXMLSignedInfo Id="cXMLSignedInfo"
signatureVersion="1.0"
payloadID="xxx"/>
</ds:Object>
The value of the Id attribute must be "cXMLSignedInfo". The values of the signatureVersion and
payloadID attributes must exactly match the values specified in the cXML element, and the receiver of the
document must verify this match. No transforms should be used in this ds:Reference. This element must be
signed via the first ds:Reference object in the ds:SignedInfo, as follows:
<ds:Reference URI="#cXMLSignedInfo">
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>xxxxxxxxxxxxxxxxxxxxxxxxxxx</ds:DigestValue>
</ds:Reference>
The Request, Response, or Message element should be signed in its entirety. To do this, specify the string
"cXMLData" as the value of the Id attribute on the Request, Response, or Message element and include a
ds:Reference element with the URI "#cXMLData" in the ds:SignedInfo. No transforms should be applied
to this reference. This ds:Reference must be the second ds:Reference in the ds:SignedInfo.
The ds:KeyInfo element should be present with a single ds:X509Certificate element. This should
include the Base64 encoding of the DER representation of an X.509 certificate containing the public key
corresponding to the private key used to sign the document.
The use of XAdES is required for digital signatures. In the signature, xades:QualifyingProperties should
be the second ds:Object. The xades:SignedProperties element and all its children must be signed by
specifying "XAdESSignedProps" as the value for the Id attribute of xades:SignedProperties and including
a ds:Reference with the URI "#XAdESSignedProps" and no transforms in the ds:SignedInfo. When using
XAdES, the certificate referred to in the xades:Cert element must be the same as that contained in the
ds:KeyInfo element, the Id attribute of the ds:Signature element must be set to cXMLSignature and the
Target attribute of xades:QualifyingProperties must be #cXMLSignature.
If the document in question includes attachments, digital signatures can be used to sign just the document, or
both the document and its attachments. Signatures are structured in such a way that if the attachments are
discarded, the signature on the document itself can still be validated.
The attachments should be signed using ds:Reference elements in a ds:Manifest element included under
a ds:Object contained in the signature. The Id attribute of the ds:Manifest element must be
"AttachmentManifest". The ds:Object should occur immediately after the ds:Object containing the
xades:QualifyingProperties element, if it is present. Otherwise, it should occur immediately after the
ds:Object containing the cXMLSignedInfo element.
Each ds:Reference in the manifest should use a URI with the "cid:" scheme to refer to the attachments
through their MIME Content-Id. The ds:Manifest element itself should be signed using a fragment URI
reference included in the ds:SignedInfo. This requirement exists because a compliant XML signature
implementation must validate all the ds:Reference elements under ds:SignedInfo. Base validation
ensures that the manifest itself has not been corrupted, but will not validate the objects referred to in the
manifest. This approach makes it possible to validate the document on its own if the attachments have been
discarded. For example:
<ds:Object>
<ds:Manifest Id="AttachmentManifest">
<ds:Reference URI="cid:23482390498.34284203.part1@some.host.com">
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>P6ua59kKBLLtMBFE+IwPUgp2xqc=</ds:DigestValue>
</ds:Reference>
<ds:Reference URI="cid:23482390498.34284203.part2@some.host.com">
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>P6ua59kKBLLtMBFE+IwPUgp2xqc=</ds:DigestValue>
</ds:Reference>
</ds:Manifest>
</ds:Object>
475 Signature Required The receiver is unwilling to accept the document because it does not have a digi
tal signature.
476 Signature Verification The receiver is unable to validate the signature, possibly because the document
Failed was altered in transit, or the receiver does not support one or more algorithms
used in the signature.
477 Signature Unacceptable The signature is technically valid, but is not acceptable to the receiver for some
other reason. The signature policies or certificate policies might be unaccepta
ble, the type of certificate used might be unacceptable, or there might be some
other problem.
The following example shows a signed invoice. Note that the digest values and signature value are not correct,
because parts of the invoice document have been abbreviated for this example.
The following table provides a brief history of the updates to this guide.
Month/year of
update Updated topics Short description of change
October 2020 cXML Basics Updated “Handling Special Characters in Documents” topic.
January 2020 cXML Basics Updated “Base Elements” topic, adding State element.
October 2019 cXML Basics Updated “Type Entities” topic, adding isoStateCode.
July 2018 Title page Removed the subtitle, which incorrectly specified a cXML version.
This book applies to all cXML versions.