public class Json2XmlValidator extends XmlValidator implements HasPhysicalDestination
Pipe
that validates the XML or JSON input message against a XML Schema and returns either XML or JSON.XmlValidator.ResponseValidatorWrapper
Modifier and Type | Field and Description |
---|---|
static String |
INPUT_FORMAT_SESSION_KEY_PREFIX |
ABSTRACTXMLVALIDATOR, configurationException, validator
parameterNamesMustBeUnique
log
LONG_DURATION_MONITORING_EVENT, MESSAGE_SIZE_MONITORING_EVENT, PIPE_EXCEPTION_MONITORING_EVENT
Constructor and Description |
---|
Json2XmlValidator() |
Modifier and Type | Method and Description |
---|---|
String |
addNamespace(String xml) |
protected PipeRunResult |
alignJson(String messageToValidate,
PipeLineSession session,
boolean responseMode) |
protected PipeRunResult |
alignXml2Json(String messageToValidate,
PipeLineSession session,
boolean responseMode) |
void |
configure()
Configure the XmlValidator
|
jakarta.json.JsonStructure |
createJsonSchema(String elementName) |
jakarta.json.JsonStructure |
createJsonSchema(String elementName,
String namespace) |
jakarta.json.JsonObject |
createJsonSchemaDefinitions(String definitionsPath) |
jakarta.json.JsonStructure |
createRequestJsonSchema() |
jakarta.json.JsonStructure |
createResponseJsonSchema() |
PipeRunResult |
doPipe(Message input,
PipeLineSession session,
boolean responseMode,
String messageRoot)
Validate the XML or JSON input, and align/convert it into JSON or XML according to a XML Schema.
|
protected RootValidations |
getJsonRootValidations(boolean responseMode) |
DocumentFormat |
getOutputFormat(PipeLineSession session,
boolean responseMode) |
String |
getPhysicalDestinationName() |
void |
setAcceptNamespacelessXml(boolean acceptNamespacelessXml)
If true, all XML is allowed to be without namespaces.
|
void |
setAcceptNamespaceLessXml(boolean acceptNamespacelessXml)
Deprecated.
|
void |
setAllowJson(boolean allowJson)
Allow JSON input
|
void |
setAutoFormat(boolean autoFormat)
If true, the format on 'output' is set to the same as the format of the input message on 'input'.
|
void |
setCompactJsonArrays(boolean compactJsonArrays)
If true assume arrays in JSON do not have the element containers like in XML
|
void |
setDeepSearch(boolean deepSearch)
If true, and converting from JSON to XML, parameter substitutions are searched for optional sub elements too.
|
void |
setFailOnWildcards(boolean failOnWildcards)
If true, an exception is thrown when a wildcard is found in the XML Schema when parsing an object.
|
void |
setIgnoreUndeclaredElements(boolean ignoreUndeclaredElements)
If true, and converting from JSON to XML, elements in JSON that are not found in the XML Schema are ignored
|
void |
setInputFormatSessionKey(String inputFormatSessionKey)
Session key to store the inputFormat in, to be able to set the outputformat when autoFormat=true.
|
void |
setJsonWithRootElements(boolean jsonWithRootElements)
If true, assume that JSON contains/must contain a root element
|
void |
setOutputFormat(DocumentFormat outputFormat)
Default format of the result, that is used if the format cannot be found from outputFormatSessionKey or from inputFormatSessionKey (when validating responses and autoFormat=true)
|
void |
setOutputFormatSessionKey(String outputFormatSessionKey)
Session key to retrieve outputFormat from
|
void |
setProduceNamespacelessXml(boolean produceNamespacelessXml)
If true, all XML that is generated is without a namespace set
|
void |
setProduceNamespaceLessXml(boolean produceNamespacelessXml)
Deprecated.
|
void |
setStrictJsonArraySyntax(boolean strictJsonArraySyntax)
If true check that incoming JSON adheres to the specified syntax (compact or full), otherwise both types are accepted for conversion from JSON to XML
|
void |
setTargetNamespace(String targetNamespace)
Only for JSON input: namespace of the resulting XML.
|
void |
setValidateJsonToRootElementOnly(boolean validateJsonToRootElementOnly)
If true, and converting to or from JSON, then the message root is the only rootValidation, ignoring root validations like for SOAP envelope and header set by descender classes like SoapValidator
|
protected void |
storeInputFormat(DocumentFormat format,
Message input,
PipeLineSession session,
boolean responseMode) |
addInvalidRootNamespaces, addRequestRootValidation, addResponseRootValidation, addRootValidation, afterPropertiesSet, checkSchemaSpecified, createRootValidation, determineForward, getCharset, getConfigurationException, getDocumentation, getErrorResult, getIgnoreUnknownNamespaces, getInvalidRootNamespaces, getMessageRoot, getMessageRoot, getReasonSessionKey, getRequestRootValidations, getResponseRootValidations, getResponseValidator, getRootValidations, getSchema, getSchemas, getSchemas, getSchemas, getSchemasId, getSchemasId, getSoapNamespace, getSpecialDefaultValue, getXmlReasonSessionKey, getXsds, getXSModels, isConfiguredForMixedValidation, isFullSchemaChecking, isThrowException, isValidateFile, setAddNamespaceToSchema, setCharset, setFullSchemaChecking, setIgnoreCaching, setIgnoreUnknownNamespaces, setImplementation, setImportedNamespacesToIgnore, setImportedSchemaLocationsToIgnore, setNoNamespaceSchemaLocation, setReasonSessionKey, setResponseRoot, setRoot, setRootElementSessionKey, setRootNamespaceSessionKey, setSchema, setSchemaLocation, setSoapNamespace, setThrowException, setUseBaseImportedSchemaLocationsToIgnore, setValidateFile, setWarn, setXmlReasonSessionKey, setXmlSchemaVersion, start, stop, validate
determineForward, doPipe, setForwardFailureToSuccess, setSchemaSessionKey, validate, validate
getParameterValue, setIfParam, setIfValue, setOnlyIfSessionKey, setOnlyIfValue, setSkipOnEmptyInput, setUnlessSessionKey, setUnlessValue, skipPipe
addParameter, consumesSessionVariable, createBean, findForward, getAdapter, getEventSourceName, getForwards, getInSizeStatDummyObject, getOutSizeStatDummyObject, getParameterList, getParameterOverriddenAttributeValue, getParameterValueList, hasSizeStatistics, registerEvent, registerForward, setApplicationContext, setChompCharSize, setDurationThreshold, setElementToMove, setElementToMoveChain, setElementToMoveSessionKey, setEmptyInputReplacement, setGetInputFromFixedValue, setGetInputFromSessionKey, setHideRegex, setLocker, setLogIntermediaryResults, setMaxThreads, setName, setPreserveInput, setRemoveCompactMsgNamespaces, setRestoreMovedElements, setSecLogSessionKeys, setSizeStatistics, setStoreResultInSessionKey, setWriteToSecLog, throwEvent
configureTransactionAttributes, isTransacted, isTransacted, setTransacted, setTransactionTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDomain
getSchemaLocation
setName, validate
consumesSessionVariable, doPipe, getForwards, getMaxThreads, registerForward
getName
getApplicationContext, getName
getConfigurationClassLoader
setApplicationContext
getName
getChompCharSize, getDurationThreshold, getElementToMove, getElementToMoveChain, getElementToMoveSessionKey, getEmptyInputReplacement, getGetInputFromFixedValue, getGetInputFromSessionKey, getLocker, getSecLogSessionKeys, getStoreResultInSessionKey, isPreserveInput, isRemoveCompactMsgNamespaces, isRestoreMovedElements, isWriteToSecLog, setPipeLine
getTransactionAttribute, getTransactionTimeout, getTxDef, setTransactionAttribute
public static final String INPUT_FORMAT_SESSION_KEY_PREFIX
public void configure() throws ConfigurationException
XmlValidator
configure
in interface IConfigurable
configure
in interface IPipe
configure
in class XmlValidator
ConfigurationException
- when:
XmlValidator.isThrowException()
is false and there is no forward defined
for "failure"public DocumentFormat getOutputFormat(PipeLineSession session, boolean responseMode) throws PipeRunException
PipeRunException
protected void storeInputFormat(DocumentFormat format, Message input, PipeLineSession session, boolean responseMode)
public PipeRunResult doPipe(Message input, PipeLineSession session, boolean responseMode, String messageRoot) throws PipeRunException
doPipe
in class XmlValidator
PipeRunException
- when isThrowException
is true and a validationerror occurred.protected RootValidations getJsonRootValidations(boolean responseMode)
protected PipeRunResult alignXml2Json(String messageToValidate, PipeLineSession session, boolean responseMode) throws XmlValidatorException, PipeRunException, ConfigurationException
protected PipeRunResult alignJson(String messageToValidate, PipeLineSession session, boolean responseMode) throws PipeRunException, XmlValidatorException
public jakarta.json.JsonStructure createRequestJsonSchema()
public jakarta.json.JsonStructure createResponseJsonSchema()
public jakarta.json.JsonObject createJsonSchemaDefinitions(String definitionsPath)
public jakarta.json.JsonStructure createJsonSchema(String elementName)
public jakarta.json.JsonStructure createJsonSchema(String elementName, String namespace)
public String getPhysicalDestinationName()
getPhysicalDestinationName
in interface HasPhysicalDestination
public void setTargetNamespace(String targetNamespace)
public void setOutputFormat(DocumentFormat outputFormat)
public void setOutputFormatSessionKey(String outputFormatSessionKey)
public void setInputFormatSessionKey(String inputFormatSessionKey)
public void setAutoFormat(boolean autoFormat)
public void setCompactJsonArrays(boolean compactJsonArrays)
public void setStrictJsonArraySyntax(boolean strictJsonArraySyntax)
public void setJsonWithRootElements(boolean jsonWithRootElements)
public void setDeepSearch(boolean deepSearch)
public void setIgnoreUndeclaredElements(boolean ignoreUndeclaredElements)
public void setFailOnWildcards(boolean failOnWildcards)
public void setAcceptNamespacelessXml(boolean acceptNamespacelessXml)
@Deprecated @ConfigurationWarning(value="The attribute \'acceptNamespaceLessXml\' has been renamed \'acceptNamespacelessXml\'") public void setAcceptNamespaceLessXml(boolean acceptNamespacelessXml)
public void setProduceNamespacelessXml(boolean produceNamespacelessXml)
@Deprecated @ConfigurationWarning(value="The attribute \'produceNamespaceLessXml\' has been renamed \'produceNamespacelessXml\'") public void setProduceNamespaceLessXml(boolean produceNamespacelessXml)
public void setValidateJsonToRootElementOnly(boolean validateJsonToRootElementOnly)
public void setAllowJson(boolean allowJson)
Copyright © 2023 Frank!Framework. All rights reserved.