CDATA Conversion Service

The CDATA Conversion service converts the CDATA used by Sterling B2B Integrator to the Transora-required PCDATA format as needed.

The CDATA Conversion service is designed to be used only with the Transora™ Data Catalog (TDC) 3.2 adapter. The following table provides an overview of the CDATA Conversion service:

System name CDATAConversionService
Graphical Process Modeler (GPM) categories All Services, Transora
Description Converts CDATA sections within the primary document to and from PCDATA. This service is used only with the Transora (TDC) 3.2 adapter.
Business usage Transora does not accept XML documents with CDATA sections. Certain Sterling B2B Integrator services, such as the Translation service, may require any XML documents to use entity characters (& > < ‘ “) in CDATA sections rather than using XML entity references such as &amp; for the ampersand character. This service converts the CDATA used by Sterling B2B Integrator to the Transora-required PCDATA format as needed.
Usage example A user wants to send an Add Item request to Transora, and they use a Translation service with a map to generate the Transora XML request document. The XML output of the Translation service contains CDATA sections, but Transora will not accept CDATA. So the CDATAConversionService is used to convert the CDATA sections to PCDATA with entity references.
Preconfigured? Yes. A configuration named CDataConversionService is installed with the TDC 3.2 adapter.
Requires third party files? No
Platform availability All supported Sterling B2B Integrator platforms
Related services TDC 3.2 adapter
Application requirements No
Initiates business processes? No
Invocation Not applicable
Business process context considerations None
Returned status values
Returned status values:
  • Success – Primary document was successfully converted.
  • Error – CDataMode parameter was not set, or the primary document could not be parsed and converted.
Restrictions None. Any number of instances may be created, but typically a single instance can be shared by any number of business processes.
Testing considerations To test it, create an instance, then run it from a business process as described in the usage example. Provide an XML document as the primary document for the business process. Viewing the resulting document in a browser from the Sterling B2B Integrator web console can be problematic; XML entity references and CDATA sections may not appear in the browser the same way they are stored in the underlying document. Therefore, a better method is to save the resulting file to disk and view it using a text editor or XML editing tool.

How the CDATA Conversion Service Works

The CDATA Conversion service converts CDATA sections within the primary document to and from PCDATA.

Outbound

In CDATA_TO_PCDATA mode, Sterling B2B Integrator converts any CDATA sections to PCDATA, and converts the five standard entity characters (&, <, >, “, and ‘) to their corresponding entity references (&amp; &lt; &gt; &quot; &apos;). For example, see the following fragment:

<myTag><![CDATA[Joe & Sally]></myTag>

would be converted to:

<myTag>Joe &amp; Sally</myTag>

Inbound

In PCDATA_TO_CDATA mode, the primary document must contain a valid XML document. In PCDATA_TO_CDATA mode, elements containing any of the five standard entity references are converted to CDATA sections without entity references. For example, &amp; converts to the single character &. The following example illustrates this conversion:

<myTag>Joe &amp; Sally</myTag>

would be converted to:

<myTag><![CDATA[Joe & Sally]></myTag>

Code Sample

The following code example runs the CDATA Conversion service in a business process:

<operation name="PCDATA to CDATA">
      <participant name="CDataConversionService"/>
      <output message="noopout">
        <assign to="." from="*"></assign>
        <assign to="CDataMode">PCDATA_TO_CDATA</assign>
      </output>
      <input message="noopin">
        <assign to="." from="*"></assign>
      </input> 
</operation>

Implementing the CDATA Conversion Service

The CDATA Conversion service installs automatically with the TDC 3.2 adapter, and is part of the TDC 3.2 adapter implementation. For information, see Transora Data Catalog (TDC) 3.2 Adapter.

For general information about creating service and adapter configurations, see Managing Services and Adapters.

To implement the CDATA Conversion service, complete the following tasks:
  1. Implement and configure the TDC 3.2 adapter to be used with this service. For information, see Transora Data Catalog (TDC) 3.2 Adapter .
  2. Configure the pre-installed copy of the CDATA Conversion service. For information, see Configuring the CDATA Conversion Service.
  3. Use the CDATA Conversion service in a business process.

Configuring the CDATA Conversion Service

To configure the CDATA Conversion service, you must specify settings for the following fields in the GPM:

Field Description
Config Name of the service configuration. Required.
CDataMode Data conversion mode for the adapter. Optional at configuration time, but required at run time. Valid values are PCDATA_TO_CDATA and CDATA_TO_PCDATA.