Hi Supun,

In validate mediator multiple schemas can be validated as a list.

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse";
       name="Validation"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <validate>
            <schema key="{schema1}"/>
            <schema key="{schema2}"/>
            <schema key="{schema3}"/>
            <schema key="{schema4}"/>
            <on-fail>
               <makefault version="soap11">
                  <code xmlns:soap11Env="
http://schemas.xmlsoap.org/soap/envelope/";
                        value="soap11Env:VersionMismatch"/>
                  <reason value="fault"/>
                  <role/>
               </makefault>
            </on-fail>
         </validate>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>

Thanks,


On Thu, Sep 10, 2015 at 2:19 AM, Supun Sethunga <[email protected]> wrote:

> Hi,
>
> I have proxy where messages coming in to the proxy needed to be validated
> against *one of the xsd*'s. I managed to get this working by using nested
> validator mediators in the following way.
>
>      *   <validate>*
> *            <schema key="xsd_01"/>*
> *            <on-fail>*
> *               <validate>*
> *                  <schema key="xsd_02"/>*
> *                  <on-fail>*
> *                     <validate>*
> *                        <schema key="xsd_03"/>*
> *                        <on-fail>*
> *                           <validate>*
> *                              <schema key="xsd_04"/>*
> *                              <on-fail>*
> *                                 <makefault version="pox"
> description="InvalidRequest">*
> *                                    <reason value="Invalid request XML
> accroding to schema definitions."/>*
> *                                 </makefault>*
> *                                 <property name="HTTP_SC" value="400"
> scope="axis2" type="STRING" description="HTTP_SC_400"/>*
> *                                 <property name="RESPONSE" value="true"
> scope="default"  type="STRING" description="RESPONSE"/>*
> *                                 <log level="custom" category="WARN"
> description="Bad request">*
> *                                    <property name="ErrorDetails"
> value="Bad request: invalid request XML according to schemas."/>*
> *                                 </log>*
> *                                 <respond/>*
> *                              </on-fail>*
> *                           </validate>*
> *                        </on-fail>*
> *                     </validate>*
> *                  </on-fail>*
> *               </validate>*
> *            </on-fail>*
> *         </validate>*
>
> Is there a way to define them as a list, rather than the above approach?
>
> Thanks,
> Supun
>
> --
> *Supun Sethunga*
> Software Engineer
> WSO2, Inc.
> http://wso2.com/
> lean | enterprise | middleware
> Mobile : +94 716546324
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Viraj Senevirathne
Software Engineer; WSO2, Inc.

Mobile : +94 71 958 0269
Email : [email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to