XPL - oxf:xforms-submission

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

XPL - oxf:xforms-submission

Lomobob
Hi,

In a xpl file, I have a submission block like this:

<p:processor name="oxf:xforms-submission">
        <p:input name="submission">            
            <xforms:submission method="get" resource="http://localhost:8080/mywebservice/var123"/>
        </p:input>
        <p:input name="request">
            <empty/>
        </p:input>
        <p:output name="response" id="data-xml"/>
    </p:processor>

And it works.

My goal is to replace var123 with something from an URL request. I suppose I have to use a <p:processor name="oxf:unsafe-xslt"> to do that; I tried this code below, but I guess I'm doing it wrong:

<p:processor name="oxf:unsafe-xslt">
        <p:input name="request" href="#request"/>            
        <p:input name="config">
                       
            <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                <xsl:output method="xml"/>
                <xsl:variable name="url-part" select="tokenize(doc('input:request')/request/request-uri,'/')"/>                 
                <xsl:variable name="uri" select="concat( 'http://localhost:8080/mywebservice/' , $url-part[3] )"/>
                <xsl:template match="/">
                    <xforms:submission method="get" resource="{$uri}"/>
                </xsl:template>
            </xsl:stylesheet>
                        
        </p:input>
        <p:output name="data" id="outxslt"/>
    </p:processor>

<p:processor name="oxf:xforms-submission">        
        <p:input name="submission" href="#outxslt"/>
        <p:input name="request">
            <empty/>
        </p:input>
        <p:output name="response" id="data-xml"/>
    </p:processor>


Could anyone tell me my mistake ?

Thanks !

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: XPL - oxf:xforms-submission

Alessandro  Vernet
Administrator
Hi Lomobob,

You are on the right track, and can use transform="oxf:xslt" on that input to avoid a separate XSLT processor in the XPL. Also don't forget to use encode-for-uri() to escape characters that would not be allowed otherwise, or could even lead to a security issue if you're calling an internal service. See for instance how it is done here:

https://github.com/orbeon/orbeon-forms/blob/tag-release-4.7-ce/src/resources/apps/fr/persistence/relational/search.xpl#L128

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: XPL - oxf:xforms-submission

Lomobob
HI Alex, I tried this, but I still have an error:

<p:processor name="oxf:request">
<p:input name="config">
<config stream-type="xs:anyURI">
<include>/request/request-uri</include>
</config>
</p:input>
<p:output name="data" id="request"/>
</p:processor>


<p:processor name="oxf:xforms-submission">      
        <p:input name="request"><dummy/></p:input>
        <p:input name="submission" transform="oxf:xslt" href="#request">            
            <xforms:submission xsl:version="2.0" method="get" resource="http://localhost:8080/mywebservice/{encode-for-uri(tokenize(doc('input:request')/request/request-uri,'/')[3])}"/>
        </p:input>        
        <p:output name="response" id="data-xml"/>
    </p:processor>

Any idea ?

Thanks.

On Mon, Oct 13, 2014 at 7:15 PM, Alessandro Vernet <[hidden email]> wrote:
Hi Lomobob,

You are on the right track, and can use transform="oxf:xslt" on that input
to avoid a separate XSLT processor in the XPL. Also don't forget to use
encode-for-uri() to escape characters that would not be allowed otherwise,
or could even lead to a security issue if you're calling an internal
service. See for instance how it is done here:

https://github.com/orbeon/orbeon-forms/blob/tag-release-4.7-ce/src/resources/apps/fr/persistence/relational/search.xpl#L128

Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
View this message in context: http://discuss.orbeon.com/XPL-oxf-xforms-submission-tp4659107p4659108.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].