Login  Register

Re: Re: Re: Re: Re: Re: Validation Response

Posted by bsteuhl on Feb 21, 2011; 11:06pm
URL: https://discuss.orbeon.com/Validation-Response-tp3230774p3318315.html

Eric,

If you create an application called schemaService and create the three files listed below in that folder you can create a RESTful service like I did.  In SOAPUI create a a new project and check the box to Create a new rest service using your location information.  At the end of this message l also provide the xml for SOAPUI test.

XPL file called 'validate.xpl'

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:xs="http://www.w3.org/2001/XMLSchema"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:oxf="http://www.orbeon.com/oxf/processors"
                  xmlns:delegation="http://orbeon.org/oxf/xml/delegation"
                  xmlns:aopc="http://jnet.state.pa.us/jxdm/aopc" 
                  xmlns="http://jnet.state.pa.us/jxdm/aopc" 
                  xmlns:j="http://www.it.ojp.gov/jxdm/3.0"
                  xmlns:v="http://orbeon.org/oxf/xml/validation"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <p:param type="input" name="instance"/>
        <p:param type="output" name="data"/>

        <p:processor name="oxf:validation">
                <p:input name="config">
                        <config>
                                <decorate>true</decorate>
                        </config>
                </p:input>
                <p:input name="schema" href="test.xsd"/>
               
                <p:input name="data" href="#instance"/>
                <p:output name="data" id="data" />
        </p:processor>
       
         
       
        <p:processor name="oxf:xslt"> 
                <p:input name="data" href="#data"/> 
                <p:input name="config"> 
                        <xsl:stylesheet version="2.0" xmlns:aopc="http://jnet.state.pa.us/jxdm/aopc" 
                  xmlns="http://jnet.state.pa.us/jxdm/aopc" 
                  xmlns:j="http://www.it.ojp.gov/jxdm/3.0"
                  xmlns:v="http://orbeon.org/oxf/xml/validation"> 
                                <xsl:template match="/"> 
                                        <document xsi:type="xs:string" content-type="text/plain">
                                                <xsl:copy-of select="/" />
                                        </document>
                                </xsl:template> 
                        </xsl:stylesheet>
                </p:input> 
                <p:output name="data" ref="data"/>
        </p:processor>

        </p:config>

page-flow.xml

<config xmlns="http://www.orbeon.com/oxf/controller">

        <page path-info="/schemaService/" view="validate.xpl"></page>
       
        <epilogue url="oxf:/config/epilogue.xpl"/>

</config>

Schema file called test.xsd

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/schemaValidation" xmlns:tns="http://www.example.org/schemaValidation" elementFormDefault="qualified">
    <element name="test" type="tns:testType"></element>
   
        <complexType name="testType">
                <sequence>
                        <element name="select">
                                <simpleType>
                                        <restriction base="string">
                                                <enumeration value="Yes"/>
                                                <enumeration value="No"/>
                                        </restriction>
                                </simpleType>
                        </element>
                </sequence>
        </complexType>
       
</schema>

And here is the xml for SOPAUI:

<test xmlns="http://www.example.org/schemaValidation">
<select>No</select>
</test>

If you put in Yes or No the validation succeeds.  Anything else the Orbeon HTML error is thrown instead of decorating mode with error tags.

Let me know if you need anything else.

Brian Steuhl
BTM Software Solutions