Recursion in pipelines

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

Recursion in pipelines

ISOmorph
Hi,

I have problems implementing a self reccuring pipeline.
I followed Alessandro's instructions on this post:
http://orbeon-forms-ops-users.24843.n4.nabble.com/Recurrence-td29961.html#a29965

I updated and adapted the code (recursion.xpl), and get this error:
Error tag name "html" is not allowed(schema: http://www.orbeon.com/oxf/pipeline)

First I thought an error in the code produced an error page, sent trough the recurring pipeline.
But I ran trough each step of the recursion (by manually calling the pipeline with the results it provided in each step), and had no errors whatsoever. Here is the test data I used: test.xml

I'd like to add that this pipeline is meant to function as a web service at some point.

Thank you for your help,
Marc
Reply | Threaded
Open this post in threaded view
|

Re: Recursion in pipelines

ISOmorph
Too bad nobody seems able to hint me in the right direction.
I'll try to clarify my problem.

I have a web service set up getting a soap message, the important part for this question is:
       <cycle>4</cycle>
       <step-size>6</step-size>

       <step>0</step>
       <count>0</count>

The web service is in fact an xpl, which I instruct to read the soap message:
       <p:processor name="oxf:request">
                <p:input name="config">
                        <config stream-type="xs:anyURI" xmlns:xs="http://www.w3.org/2001/XMLSchema">
                                <include>/request/body</include>
                        </config>
                </p:input>
                <p:output name="data" id="request"/>
        </p:processor>
 
        <p:processor name="oxf:url-generator">
                <p:input name="config" href="aggregate('config', aggregate('url', #request#xpointer(string(/request/body))))"/>
                <p:output name="data" id="content"/>
        </p:processor>

Now the webservice does his thing and discerns two cases:
1) The recursion has reached its final step and returns a response message:
        <p:when test="//count = //cycle">                       
                <p:processor name="oxf:xml-serializer">
                        <p:input name="config">
                                <config/>
                        </p:input>
                        <p:input name="data" href="#content"/>
                </p:processor>
        </p:when>

2) The recursion needs one more step:
        <p:otherwise>
                ...
                <p:processor name="oxf:xslt">
                        <step>
                                <xsl:copy-of select="(//step-size * (//count + 1)) - 1"/>
                        </step>
                        <count>
                                <xsl:copy-of select="//count + 1"/>
                        </count>
                </p:processor>
                ...
                <p:processor name="oxf:pipeline">
                        <p:input name="config" href="http://127.0.0.1:8080/orbeon/service-experiment/"/>
                        <p:input name="data" href="#rebuild#xpointer(//config)"/>
                </p:processor>
        </p:otherwise>

Sadly this method doesn't seem to work.
I desperatly need some advice on how to fix that.

Thank you all in advance.
Marc
Reply | Threaded
Open this post in threaded view
|

Re: Re: Recursion in pipelines

Hank Ratzesberger-2
Hi Marc,

Well, it's not completely clear to me what you want to do, but you
should be able to recursively call xpl.  However, such an xpl should
have an input and output pipleline.  I think a pipleline can have
only one serialization, as the last step.  

--Hank

On Sep 13, 2010, at 5:29 AM, ISOmorph wrote:

>
> Too bad nobody seems able to hint me in the right direction.
> I'll try to clarify my problem.
>
> I have a web service set up getting a soap message, the important part for
> this question is:
>       <cycle>4</cycle>
>       <step-size>6</step-size>
>
>       <step>0</step>
>       <count>0</count>
>
> The web service is in fact an xpl, which I instruct to read the soap
> message:
>       <p:processor name="oxf:request">
> <p:input name="config">
> <config stream-type="xs:anyURI"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <include>/request/body</include>
> </config>
> </p:input>
> <p:output name="data" id="request"/>
> </p:processor>
>
> <p:processor name="oxf:url-generator">
> <p:input name="config" href="aggregate('config', aggregate('url',
> #request#xpointer(string(/request/body))))"/>
> <p:output name="data" id="content"/>
> </p:processor>
>
> Now the webservice does his thing and discerns two cases:
> 1) The recursion has reached its final step and returns a response message:
>        <p:when test="//count = //cycle">
> <p:processor name="oxf:xml-serializer">
> <p:input name="config">
> <config/>
> </p:input>
> <p:input name="data" href="#content"/>
> </p:processor>
>        </p:when>
>
> 2) The recursion needs one more step:
>        <p:otherwise>
>                ...
>                <p:processor name="oxf:xslt">
>                        <step>
> <xsl:copy-of select="(//step-size * (//count + 1)) - 1"/>
> </step>
> <count>
> <xsl:copy-of select="//count + 1"/>
> </count>
>                </p:processor>
>                ...
>                <p:processor name="oxf:pipeline">
>                        <p:input name="config"
> href="http://127.0.0.1:8080/orbeon/service-experiment/"/>
>                        <p:input name="data"
> href="#rebuild#xpointer(//config)"/>
>                </p:processor>
>        </p:otherwise>
>
> Sadly this method doesn't seem to work.
> I desperatly need some advice on how to fix that.
>
> Thank you all in advance.
> Marc
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Recursion-in-pipelines-tp2331278p2537336.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Recursion in pipelines

ISOmorph
Thank you for the quick response.
But I already tried this approach, when I try to use an input and output, I get an error I can not resolve:
ASTChoose branch number 2 does not declare the same ids [] as the previous branches [data]
(@ oxf:/apps/service-experiment/recursion.xpl line 28)

Here are my changes:
At the beginning:
    <p:param type="input" name="data"/>
    <p:param type="output" name="data"/> 

line 28:
    <p:choose href="#data">
        <p:when test="//count = //cycle">
                <p:processor name="oxf:identity">
                        <p:input name="data" href="#data"/>
                        <p:output name="data" id="data"/>
                </p:processor>
        </p:when>

and at the end:
        <p:otherwise>
           ...
           <p:processor name="oxf:pipeline">
                <p:input name="config" href="http://127.0.0.1:8080/orbeon/service-experiment/"/>
                <p:input name="data" href="#rebuild#xpointer(//config)"/>
                <p:output name="data" ref="data"/> 
            </p:processor>
        </p:otherwise>
    </p:choose>

As you can see the, the same ids are declared in every branch, hence my problem to resolve the error.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Recursion in pipelines

Hank Ratzesberger-2
Ah yes.  That had me puzzled the for sometime also,
but for whatever likely good reason, the parser/engine
does not accommodate needs to have the same element id's
declared in each branch.

Your first choose branch creates an infoset with the id 'data',
but the second references the output parameter. If you didn't
intend to create the set, then both choose branches need to
create the set and outside it you can "consume" it using

<p:processor name="oxf:null-serializer">
  <p:input name="data" href="#data"/>
</p:processor>

HTH,
Hank


On Sep 14, 2010, at 2:34 AM, ISOmorph wrote:

>
> Thank you for the quick response.
> But I already tried this approach, when I try to use an input and output, I
> get an error I can not resolve:
> ASTChoose branch number 2 does not declare the same ids [] as the previous
> branches [data]
> (@ oxf:/apps/service-experiment/recursion.xpl line 28)
>
> Here are my changes:
> At the beginning:
>    <p:param type="input" name="data"/>
>    <p:param type="output" name="data"/>
>
> line 28:
>    <p:choose href="#data">
>        <p:when test="//count = //cycle">
> <p:processor name="oxf:identity">
> <p:input name="data" href="#data"/>
> <p:output name="data" id="data"/>
> </p:processor>
>        </p:when>
>
> and at the end:
>        <p:otherwise>
>           ...
>           <p:processor name="oxf:pipeline">
>                <p:input name="config"
> href="http://127.0.0.1:8080/orbeon/service-experiment/"/>
>                <p:input name="data" href="#rebuild#xpointer(//config)"/>
> <p:output name="data" ref="data"/>
>            </p:processor>
>        </p:otherwise>
>    </p:choose>
>
> As you can see the, the same ids are declared in every branch, hence my
> problem to resolve the error.
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Recursion-in-pipelines-tp2331278p2538704.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
Hank Ratzesberger
NEES@UCSB
Earth Research Institute
University of California, Santa Barbara
805-893-8042








--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Recursion in pipelines

ISOmorph
Thanks again for helping out. Your suggestion brought me a step further. The pipeline is actually recuring, but it loops endlessly until tomcat crashes. Appearently because the soap request sent to the pipeline isn't properly fed to the input and thus the break condition is never reached.

First, I have a pipeline called model.xpl set up to handle incoming soap requests (which is working fine):
        <p:processor name="oxf:request">
                <p:input name="config">
                        <config stream-type="xs:anyURI" xmlns:xs="http://www.w3.org/2001/XMLSchema">
                                <include>/request/body</include>
                        </config>
                </p:input>
                <p:output name="data" id="request"/>
        </p:processor>
 
        <p:processor name="oxf:url-generator">
                <p:input name="config" href="aggregate('config', aggregate('url', #request#xpointer(string(/request/body))))"/>
                <p:output name="data" id="content"/>
        </p:processor>
 
        <p:processor name="oxf:identity">
                <p:input name="data" href="#content"/>
                <p:output name="data" id="identity"/>
        </p:processor>

        <p:processor name="oxf:pipeline">
                <p:input name="config" href="http://127.0.0.1:8080/orbeon/service-experiment/recursion/"/>
                <p:input name="data" href="#identity#xpointer(//config)"/>
                <p:output name="data" id="recurse"/>
        </p:processor>

        <p:processor name="oxf:xml-serializer">
                <p:input name="config">
                        <config/>
                </p:input>
                <p:input name="data" href="#recurse"/>
        </p:processor>

As you can see, this pipeline delegates the actual operations to the pipeline located at http://127.0.0.1:8080/orbeon/service-experiment/recursion/, which (for testing purposes) just does this:
    <p:param type="input" name="data"/>
    <p:param type="output" name="data"/> 

    <p:choose href="#data">               
        <p:when test="1 = 1">
                <p:processor name="oxf:identity">
                        <p:input name="data" href="#data"/>
                        <p:output name="data" ref="data"/>
                </p:processor>
        </p:when>
        <p:otherwise>...</p:otherwise>
    </p:choose>

After executing my webservice call (from soapUI), the orbeon log displays the following error:
2010-09-21 12:13:39,206 INFO  ProcessorService  - /service-experiment/ - Received request
2010-09-21 12:13:39,226 INFO  ProcessorService  - /service-experiment/recursion/ - Received request
2010-09-21 12:13:39,262 INFO  ProcessorService  - /service-experiment/recursion/ - Timing: 36 - Cache hits for cache.main: 244, fault: 4, adds: 4, expirations: 0, success rate: 98%
2010-09-21 12:13:39,265 ERROR ProcessorService  - Exception at
org.orbeon.oxf.common.ValidationException: : Fatal error: Premature end of file.
null, line -1, column -1: Fatal error: Premature end of file.

Since model.xpl is working (I've tried it whithout the call to http://127.0.0.1:8080/orbeon/service-experiment/recursion/), I tried sending the soap request directly to http://127.0.0.1:8080/orbeon/service-experiment/recursion/, which ended up returning nothing in soapUI.

So I'm guessing, either I'm adressing the input or output pipeline the wrong way. Would you have any suggestions on what I'm doing wrong?
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Recursion in pipelines

Raitis
Today, for test purposes I used simple recursion in pipeline.

    <p:processor name="oxf:xslt">
        <p:input name="data" href="#instance" />
        <p:input name="config">
            <xsl:stylesheet version="2.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                <xsl:template match="@*|node()">
                    <xsl:copy>
                        <xsl:apply-templates select="@*|node()" />
                    </xsl:copy>
                </xsl:template>
                <xsl:template match="div[@id]">
                    <xsl:element name="{local-name()}">
                        <xsl:if test="@id != '25'">
                            <xsl:attribute name="id" select="@id + 1" />
                        </xsl:if>
                        <xsl:apply-templates select="node()" />
                    </xsl:element>
                </xsl:template>
            </xsl:stylesheet>
        </p:input>
        <p:output name="data" id="xsl_file_url" />
    </p:processor>
   
    <p:choose href="#xsl_file_url">
        <p:when test="//div/@id = '25'">
            <p:processor name="oxf:identity">
                <p:input name="data" href="#xsl_file_url" />
                <p:output name="data" id="out" ref="data" />
            </p:processor>
        </p:when>
        <p:otherwise>
            <p:processor name="oxf:xforms-submission">
                <p:input name="submission">
                    <xforms:submission method="post" action="/test_app/create" />
                </p:input>
                <p:input name="request" href="#xsl_file_url" />
                <p:output name="response" id="out" ref="data" />
            </p:processor>
        </p:otherwise>
    </p:choose>

Pipeline just transform document 25 times.

Raitis

On Tue, Sep 21, 2010 at 1:34 PM, ISOmorph <[hidden email]> wrote:

Thanks again for helping out. Your suggestion brought me a step further. The
pipeline is actually recuring, but it loops endlessly until tomcat crashes.
Appearently because the soap request sent to the pipeline isn't properly fed
to the input and thus the break condition is never reached.

First, I have a pipeline called model.xpl set up to handle incoming soap
requests (which is working fine):
       <p:processor name="oxf:request">
               <p:input name="config">
                       <config stream-type="xs:anyURI"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
                               <include>/request/body</include>
                       </config>
               </p:input>
               <p:output name="data" id="request"/>
       </p:processor>

       <p:processor name="oxf:url-generator">
               <p:input name="config" href="aggregate('config', aggregate('url',
#request#xpointer(string(/request/body))))"/>
               <p:output name="data" id="content"/>
       </p:processor>

       <p:processor name="oxf:identity">
               <p:input name="data" href="#content"/>
               <p:output name="data" id="identity"/>
       </p:processor>

       <p:processor name="oxf:pipeline">
               <p:input name="config"
href="http://127.0.0.1:8080/orbeon/service-experiment/recursion/"/>
               <p:input name="data" href="#identity#xpointer(//config)"/>
               <p:output name="data" id="recurse"/>
       </p:processor>

       <p:processor name="oxf:xslt">
               <p:input name="data" href="#recurse"/>
               <p:input name="config">
                       <soapenv:Envelope xsl:version="2.0">
                               <soapenv:Header/>
                               <soapenv:Body>
                                       <xsl:copy-of select="//experience"/>
                               </soapenv:Body>
                       </soapenv:Envelope>
               </p:input>
               <p:output name="data" id="response"/>
       </p:processor>

       <p:processor name="oxf:xml-serializer">
               <p:input name="config">
                       <config/>
               </p:input>
               <p:input name="data" href="#response"/>
       </p:processor>

As you can see, this pipeline delegates the actual operations to the
pipeline located at
http://127.0.0.1:8080/orbeon/service-experiment/recursion/, which (for
testing purposes) just does this:
   <p:param type="input" name="data"/>
   <p:param type="output" name="data"/>

   <p:choose href="#data">
       <p:when test="1 = 1">
               <p:processor name="oxf:identity">
                       <p:input name="data" href="#data"/>
                       <p:output name="data" ref="data"/>
               </p:processor>
       </p:when>
       <p:otherwise>...</p:otherwise>
   </p:choose>

After executing my webservice call (from soapUI), the orbeon log displays
the following error:
2010-09-21 12:13:39,206 INFO  ProcessorService  - /service-experiment/ -
Received request
2010-09-21 12:13:39,226 INFO  ProcessorService  -
/service-experiment/recursion/ - Received request
2010-09-21 12:13:39,262 INFO  ProcessorService  -
/service-experiment/recursion/ - Timing: 36 - Cache hits for cache.main:
244, fault: 4, adds: 4, expirations: 0, success rate: 98%
2010-09-21 12:13:39,265 ERROR ProcessorService  - Exception at
org.orbeon.oxf.common.ValidationException: : Fatal error: Premature end of
file.
null, line -1, column -1: Fatal error: Premature end of file.

Since model.xpl is working (I've tried it whithout the call to
http://127.0.0.1:8080/orbeon/service-experiment/recursion/), I tried sending
the soap request directly to
http://127.0.0.1:8080/orbeon/service-experiment/recursion/, which ended up
returning nothing in soapUI.

So I'm guessing, either I'm adressing the input or output pipeline the wrong
way. Would you have any suggestions on what I'm doing wrong?

--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Recursion-in-pipelines-tp2331278p2548341.html
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Recursion in pipelines

ISOmorph
Thank you both for your help, but for some reason I never got it fully working and lost patience.
I implemented a java class to do that for me and called it from the pipeline.