XPL Instance replacement

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

XPL Instance replacement

weyer-2
Hi,

I'm currently trying to get some data via SQL, the query seams to work
but I'm unable to get the data into my XForms instance. I added a
HTTP-Serializer to my XPL to test whether the SQL stuff works and it
shows the result as XML data so I figured it must be either a problem
with my XPL output (after the SQL-Processor) or something is wrong with
my submission.

Here is my XPL:

<?xml version="1.0" encoding="utf-8"?>

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
    xmlns:oxf="http://www.orbeon.com/oxf/processors"
    xmlns:xforms="http://www.w3.org/2002/xforms"
    xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:sql="http://orbeon.org/oxf/xml/sql">

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

  <p:processor name="oxf:sql">
    <p:input name="config">
      <sql:config>
<!-- root elelemt -->
<results>
  <sql:connection>
    <sql:datasource>portaldb</sql:datasource>
    <sql:execute>
      <sql:query>
SELECT DISTINCT BuKr FROM tAALeasingKFZ
      </sql:query>
      <sql:result-set result-sets="1">
        <myresultset>
          <sql:row-iterator>
            <row>
              <sql:get-columns format="xml"/>
            </row>
          </sql:row-iterator>
        </myresultset>
      </sql:result-set>
    </sql:execute>
  </sql:connection>
</results>
      </sql:config>
    </p:input>
    <!--p:output name="data" ref="data"/-->
    <p:output name="data" id="sql-data"/>
  </p:processor>
 
  <p:processor name="oxf:xml-converter">
    <p:input name="config">
      <config>
        <content-type>application/xml</content-type>
        <!--encoding>iso-8859-1</encoding-->
        <encoding>utf-8</encoding>
        <version>1.0</version>
      </config>
    </p:input>
    <p:input name="data" href="#sql-data"/>
    <!--p:output name="data" id="xml-document"/-->
    <p:output name="data" ref="data"/>
  </p:processor>

</p:config>

The XML-Converter was just a try, it doesn't work with or without it.

And my submission and the corresponding instance looks like this:

      <xforms:instance id="sql-response-instance"
                xxforms:exclude-result-prefixes="#all">
        <response/>
      </xforms:instance>

      <xforms:submission id="get-objects-submission"
          ref="instance('sql-response-instance')"
          replace="instance" method="post"
action="/services/sql-get-object">
       
        <xforms:action ev:observer="get-objects-submission"
            ev:event="xforms-submit-done">
          <xforms:toggle ev:event="DOMActivate"
case="instance('state-instance')/state-objekt"/>
        </xforms:action>
        <xforms:action ev:observer="get-objects-submission"
            ev:event="xforms-submit-error">
          <xforms:message level="modal">Submission error!</xforms:message>
        </xforms:action>
      </xforms:submission>

I tried it with replace="all"; the same thing.

The log always shows:

DEBUG SQLProcessor  - Executing query/call for statement:
SELECT DISTINCT BuKr FROM tAALeasingKFZ
DEBUG SQLProcessor  - ResultSet info: more result set, hasNext = true

DEBUG SQLProcessor  - Preparing to execute result set: hasMoreResultSets
= true, hasNext = true, statement =
SELECT DISTINCT BuKr FROM tAALeasingKFZ

      , currentCount = 0
DEBUG SQLProcessor  - Preparing to execute row: hasNext = true, statement =
SELECT DISTINCT BuKr FROM tAALeasingKFZ


DEBUG SQLProcessor  - Execute row: rowNum = 1
DEBUG SQLProcessor  - Execute row: rowNum = 2
DEBUG SQLProcessor  - Execute row: rowNum = 3
DEBUG SQLProcessor  - Execute row: rowNum = 4
DEBUG SQLProcessor  - ResultSet info: no more result set, update count = -1
INFO  DatabaseContext  - Committing JDBC connection for datasource:
jdbc/portaldb.
INFO  ProcessorService  - /services/sql-get-object - Timing: 203 - Cache
hits for cache.main: 236, fault: 2, adds: 0, expirations: 0, success
rate: 99%
WARN  XFormsServer  - XForms - submission - instance replacement did not
take place upon successful response because no body was provided.
Submission: get-object-submission
DEBUG XFormsServer  - XForms -       submission - external submission
time including handling returned body {time: "219"}
DEBUG XFormsServer  - XForms -       event - dispatching {name:
"xforms-submit-done", id: "get-object-submission", location: "line 35 of
XFormsSubmitDoneEvent.java"}
...

I think it's just a stupid mistake I made, but I can't seem to find the
problem. Any ideas?

Regards
Andreas Weyer



--
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: XPL Instance replacement

richhl
>       <xforms:submission id="get-objects-submission"
>           ref="instance('sql-response-instance')"
>           replace="instance" method="post"
> action="/services/sql-get-object">

do you have a corresponding:

    <page path-info="/services/sql-get-object" view="path_to_your.xpl"/>

at your page-flow.xml?

greeetings,

rich


--
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: XPL Instance replacement

weyer-2
Yes, it looks like this:

    <page path-info="/services/sql-get-object" model="sql-get-object.xpl"/>

When I open the page in the browser it returns a blank page.
I added a serializer for test purposes ..

  <p:processor name="oxf:xml-converter">
    <p:input name="config">
      <config>
        <content-type>application/xml</content-type>
        <encoding>iso-8859-1</encoding>
        <version>1.0</version>
      </config>
    </p:input>
    <p:input name="data" href="#sql-data"/>
    <p:output name="data" id="xml-document"/>
  </p:processor>
 
  <p:processor name="oxf:http-serializer">
    <p:input name="config">
      <config>
        <content-type>text-plain</content-type>
        <force-content-type>true</force-content-type>
        <encoding>utf-8</encoding>
        <force-encoding>true</force-encoding>
      </config>
    </p:input>
    <p:input name="data" href="#xml-document"/>
  </p:processor>

.. and it returns an XML structure like this one:

<results>
    <myresultset>
        <row>
            <bukr>D049</bukr>
        </row>
        <row>
            <bukr>D050</bukr>
        </row>
        <row>
            <bukr>D052</bukr>
        </row>
        <row>
            <bukr>TST</bukr>
        </row>
    </myresultset>
</results>

So the XPL is accessible. The SQL query seems to work, but i'm unsure if
the XPL returns no data or if my submit contains an error.

Here are a few more information I get before and after the SQL query:

DEBUG XFormsServer  - XForms -       connection - opening URL connection
{URL: "http://localhost:8080/orbeon/services/test-pipe-xml"}
DEBUG XFormsServer  - XForms -       submission - setting request body
{mediatype: "application/xml", body: "<?xml version="1.0"
encoding="UTF-8"?><response/>"}

So, he submits my dummy instance "<response/>".
I want exactly this instance to be overwritten with the response
"<results>...</results>" XML from the SQL Processor.

Regards
Andreas Weyer

ps: I use the current 3.7 beta


Richard C. Hidalgo Lorite wrote:

>>       <xforms:submission id="get-objects-submission"
>>           ref="instance('sql-response-instance')"
>>           replace="instance" method="post"
>> action="/services/sql-get-object">
>>    
>
> do you have a corresponding:
>
>     <page path-info="/services/sql-get-object" view="path_to_your.xpl"/>
>
> at your page-flow.xml?
>
> greeetings,
>
> rich
>  


--
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: XPL Instance replacement

weyer-2
It works now. I overlooked the VIEW attribute cause all my previous XPLs
don't return values but just invoke e.g. void EJB methods, so they work
using the MODEL attribute.

Like Richard pointed out
<page path-info="/services/sql-get-object" view="sql-get-object.xpl"/>
instead of
<page path-info="/services/sql-get-object" model="sql-get-object.xpl"/>

Thanks again and sorry for the bother.

Regards
Andreas Weyer


Andreas Weyer wrote:

> Yes, it looks like this:
>
>    <page path-info="/services/sql-get-object"
> model="sql-get-object.xpl"/>
>
> When I open the page in the browser it returns a blank page.
> I added a serializer for test purposes ..
>
>  <p:processor name="oxf:xml-converter">
>    <p:input name="config">
>      <config>
>        <content-type>application/xml</content-type>
>        <encoding>iso-8859-1</encoding>
>        <version>1.0</version>
>      </config>
>    </p:input>
>    <p:input name="data" href="#sql-data"/>
>    <p:output name="data" id="xml-document"/>
>  </p:processor>
>
>  <p:processor name="oxf:http-serializer">
>    <p:input name="config">
>      <config>
>        <content-type>text-plain</content-type>
>        <force-content-type>true</force-content-type>
>        <encoding>utf-8</encoding>
>        <force-encoding>true</force-encoding>
>      </config>
>    </p:input>
>    <p:input name="data" href="#xml-document"/>
>  </p:processor>
>
> .. and it returns an XML structure like this one:
>
> <results>
>    <myresultset>
>        <row>
>            <bukr>D049</bukr>
>        </row>
>        <row>
>            <bukr>D050</bukr>
>        </row>
>        <row>
>            <bukr>D052</bukr>
>        </row>
>        <row>
>            <bukr>TST</bukr>
>        </row>
>    </myresultset>
> </results>
>
> So the XPL is accessible. The SQL query seems to work, but i'm unsure
> if the XPL returns no data or if my submit contains an error.
>
> Here are a few more information I get before and after the SQL query:
>
> DEBUG XFormsServer  - XForms -       connection - opening URL
> connection {URL: "http://localhost:8080/orbeon/services/test-pipe-xml"}
> DEBUG XFormsServer  - XForms -       submission - setting request body
> {mediatype: "application/xml", body: "<?xml version="1.0"
> encoding="UTF-8"?><response/>"}
>
> So, he submits my dummy instance "<response/>".
> I want exactly this instance to be overwritten with the response
> "<results>...</results>" XML from the SQL Processor.
>
> Regards
> Andreas Weyer
>
> ps: I use the current 3.7 beta
>
>
> Richard C. Hidalgo Lorite wrote:
>>>       <xforms:submission id="get-objects-submission"
>>>           ref="instance('sql-response-instance')"
>>>           replace="instance" method="post"
>>> action="/services/sql-get-object">
>>>    
>>
>> do you have a corresponding:
>>
>>     <page path-info="/services/sql-get-object" view="path_to_your.xpl"/>
>>
>> at your page-flow.xml?
>>
>> greeetings,
>>
>> rich
>>  
>


--
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