Author: indika Date: Tue Jun 30 22:56:54 2009 New Revision: 40470 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=40470
Log: add example to validate mediator guide Modified: branches/esb/java/2.1/product/docs/xdoc/mediators/validate.xml Modified: branches/esb/java/2.1/product/docs/xdoc/mediators/validate.xml URL: http://wso2.org/svn/browse/wso2/branches/esb/java/2.1/product/docs/xdoc/mediators/validate.xml?rev=40470&r1=40469&r2=40470&view=diff ============================================================================== --- branches/esb/java/2.1/product/docs/xdoc/mediators/validate.xml (original) +++ branches/esb/java/2.1/product/docs/xdoc/mediators/validate.xml Tue Jun 30 22:56:54 2009 @@ -1,67 +1,92 @@ -<?xml version="1.0" encoding="iso-8859-1"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" - "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> - <title>WSO2 ESB - Validate Mediator </title> - <link href="css/esb-docs.css" rel="stylesheet" /> - <link href="styles/dist-docs.css" rel="stylesheet" type="text/css" - media="all" /> -</head> - -<body> -<h2>Validate Mediator</h2> - -<p>This mediator is used for schema validation of messages. </p> - -<p>The portion of the message that needs to be validated is chooses by -evaluating the XPath expression. Then this message is validated against the -schema spcecified. User can specify a sequence to be executed in case of a -validation failure. This mediator provide an extension point by providing -properties to configure the underline validation engine.</p> - -<h3>Syntax</h3> -<pre xml:space="preserve"> <validate [source="xpath"]> - <property name="validation-feature-id" value="true|false"/>* - <schema key="string"/>+ - <on-fail> - mediator+ - </on-fail> - </validate></pre> - -<p></p> - -<p>The validate mediator validates the result of the evaluation of the source -xpath expression, against the schema specified. If the source attribute is not -specified, the validation is performed against the first child of the SOAP body -of the current message. If the validation fails, the on-fail sequence of -mediators is executed. Properties could be used to turn on/off some of the -underlying features of the validator (See -http://xerces.apache.org/xerces2-j/features.html) </p> - -<h3>UI Configuration</h3> - -<p><img alt="Validate Mediator" src="../validate-mediator/docs/images/validate.png" /> </p> - -<h4>Key</h4> - -<p>Schema location</p> - -<h4>Source</h4> - -<p>XPath expression to extract the XML that need to be validated. If not -specified validation is performed against the first child of the SOAP body</p> - -<h4>Features</h4> - -<p>Various features of the validator, -http://xerces.apache.org/xerces2-j/features.html</p> - -<h4>Target</h4> - -<p>Please refer the Target documentation</p> - -<h3>Example</h3> -</body> -</html> +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> + <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> + <title>WSO2 ESB - Validate Mediator </title> + <link href="css/esb-docs.css" rel="stylesheet" /> + <link href="styles/dist-docs.css" rel="stylesheet" type="text/css" + media="all" /> +</head> + +<body> +<h2>Validate Mediator</h2> + +<p>This mediator is used for schema validation of messages. </p> + +<p>The portion of the message that needs to be validated is chooses by +evaluating the XPath expression. Then this message is validated against the +schema spcecified. User can specify a sequence to be executed in case of a +validation failure. This mediator provide an extension point by providing +properties to configure the underline validation engine.</p> + +<h3>Syntax</h3> +<pre xml:space="preserve"> <validate [source="xpath"]> + <property name="validation-feature-id" value="true|false"/>* + <schema key="string"/>+ + <on-fail> + mediator+ + </on-fail> + </validate></pre> + +<p></p> + +<p>The validate mediator validates the result of the evaluation of the source +xpath expression, against the schema specified. If the source attribute is not +specified, the validation is performed against the first child of the SOAP body +of the current message. If the validation fails, the on-fail sequence of +mediators is executed. Properties could be used to turn on/off some of the +underlying features of the validator (See +http://xerces.apache.org/xerces2-j/features.html) </p> + +<h3>UI Configuration</h3> + +<p><img alt="Validate Mediator" +src="../validate-mediator/docs/images/validate.png" /> </p> + +<h4>Key</h4> + +<p>Schema location</p> + +<h4>Source</h4> + +<p>XPath expression to extract the XML that need to be validated. If not +specified validation is performed against the first child of the SOAP body</p> + +<h4>Features</h4> + +<p>Various features of the validator, +http://xerces.apache.org/xerces2-j/features.html</p> + +<h4>Target</h4> + +<p>Please refer the Target documentation</p> + +<h3>Example</h3> +<ol> + <li><pre><validate> + <schema key="schema\sample.xsd"/> + <on-fail> + <makefault> + <code value="tns:Receiver" + xmlns:tns="http://www.w3.org/2003/05/soap-envelope"/> + <reason value="Invalid Request!!!"/> + </makefault> + <property name="RESPONSE" value="true"/> + <header name="To" expression="get-property('ReplyTo')"/> + </on-fail> +</validate> + </pre> + In the above validate mediator configuration, the required schema for + validating message going through the validate mediator has been given as a + registry key, <strong>schema\sample.xsd</strong>. In this sample + configuration, there is no <strong>source</strong> attribute. Therefore, in + this case, validate mediator takes source as the first child of SOAP Body. + Within <strong>on-fail</strong>, it is possible to specify mediation logic + that should to be happened if the validation is failed. In the above + configuration, it creates a SOAP fault using <strong>makefault</strong> + mediator and send back that to requested party. </li> +</ol> +</body> +</html> _______________________________________________ Esb-java-dev mailing list [email protected] https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev
