@ComponentProfile(summary="Transform a JSON document to XML, or vice versa", tag="service,transform,json,xml") public class JsonXmlTransformService extends ServiceImp
This service requires BOTH json.jar and json-lib-2.4-jdk15.jar on the classpath, since it supports both libraries to perform the conversion. Select a transformation driver to determine which library to use. The "simple" library (json.jar) yields simpler looking and cleaner XML, but will sometimes cause problems transforming XML elements into JSON arrays. The simple driver will behave exactly like the legacy JSON services, including requiring and generating an XML element names "json" to wrap the generated Xml.
The Default transformation driver uses json-lib-2.4-jdk15.jar and has a more complicated, but more information rich XML format. This format can then be used to precisely control the JSON output when converting to JSON, resolving issues like improper array generation. This driver always takes the entire message body as input and does not support converting only a part of it.
In the adapter configuration file this class is aliased as json-xml-transform-service which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
JsonXmlTransformService() |
JsonXmlTransformService(TransformationDirection direction) |
JsonXmlTransformService(TransformationDirection direction,
TransformationDriver driver) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
.
|
TransformationDirection |
getDirection()
Get the transformation direction.
|
TransformationDriver |
getDriver()
Get the transformation driver.
|
protected void |
initService() |
void |
prepare() |
void |
setDirection(TransformationDirection direction)
Set the transformation direction.
|
void |
setDriver(TransformationDriver driver)
Set the transformation driver.
|
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsConfirmation, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isConfirmation, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, rethrowServiceException, retrieveComponentState, setContinueOnFail, setIsConfirmation, setIsTrackingEndpoint, setLookupName, setUniqueId, start, stop
public JsonXmlTransformService()
public JsonXmlTransformService(TransformationDirection direction)
public JsonXmlTransformService(TransformationDirection direction, TransformationDriver driver)
public void doService(AdaptrisMessage msg) throws ServiceException
ServiceException
public void prepare() throws CoreException
CoreException
protected void closeService()
closeService
in class ServiceImp
protected void initService() throws CoreException
initService
in class ServiceImp
CoreException
public TransformationDirection getDirection()
public void setDirection(TransformationDirection direction)
direction
- The transformation direction.public TransformationDriver getDriver()
public void setDriver(TransformationDriver driver)
driver
- The transformation driver.