cancel
Showing results for 
Search instead for 
Did you mean: 

Repository Service: Batching of results

marian
Champ in-the-making
Champ in-the-making
Hi,

I am trying to batch results returned from a query.

I have specified a QueryConfiguration header with a deliberately small
fetchSize of 5. I still get all results returned, 52 rows in this case.

This is the SOAP message sent:

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Header><QueryConfiguration xmlns="http://www.alfresco.org/ws/headers/1.0"><fetchSize>5</fetchSize></QueryConfiguration>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">  <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">    <wsu:Created>2007-11-02T11:30:12Z</wsu:Created>    <wsu:Expires>2007-11-02T11:40:12Z</wsu:Expires>  </wsu:Timestamp>  <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">    <wsse:Username>XXXX</wsse:Username>    <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">TICKET_861d100ecd803dab6bb7334c22d8f54f90fc88de</wsse:Password>  </wsse:UsernameToken></wsse:Security>
</SOAP-ENV:Header><SOAP-ENV:Body><query xmlns="http://www.alfresco.org/ws/service/repository/1.0"><store><scheme xmlns="http://www.alfresco.org/ws/model/content/1.0">workspace</scheme><address xmlns="http://www.alfresco.org/ws/model/content/1.0">SpacesStore</address></store><query><language xmlns="http://www.alfresco.org/ws/model/content/1.0">lucene</language><statement xmlns="http://www.alfresco.org/ws/model/content/1.0">PARENT:"workspace://SpacesStore/14ef9fd3-80b0-11dc-a1ee-bba12bf20df2"</statement></query><includeMetaData>true</includeMetaData></query></SOAP-ENV:Body></SOAP-ENV:Envelope>

As far as I can tell the queryConfiguration is there and looking good.

What am I doing wrong?

And as follow-up-question: Where can I find discussion on the semantics
of query()/fetchMore(). I am interested in what the querySession-String
actually means. Things like:

Will it be different after each fetchMore() or do I keep the one returned from query()?

How long is it valid? Especially: Can I have more than one batched query
per user-session open at the same time?

Do I need to, or can I, "close" a batched query when I am no longer
interested in fetching more results?

Thank you for reading this and devoting brain-cycles to my problem.

MM
4 REPLIES 4

marian
Champ in-the-making
Champ in-the-making
Update:

When I created the header as:

<QueryHeader><QueryConfiguration><fetchSize>5</fetchSize></QueryConfiguration></QueryHeader>

The behaviour is the same

mruflin
Champ in-the-making
Champ in-the-making
I'm experiencing exactly the same problem.

Can somebody please post a successful soap request that takes fetchSize into consideration? I'm trying to connect to Alfresco 2.0.1E.

mruflin
Champ in-the-making
Champ in-the-making
I got it working now.

The following snippet is produced by the Java Alfresco Webservice API, omitting soapenv:actor and soapenv:mustUnderstand did also work for me (I need to get paging working using the php-sdk):


<ns1:QueryHeader
   xmlns:ns1="http://www.alfresco.org/ws/service/repository/1.0"
   soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
   soapenv:mustUnderstand="0">
   <ns2:fetchSize xmlns:ns2="http://www.alfresco.org/ws/headers/1.0">
      5
   </ns2:fetchSize>
</ns1:QueryHeader>

Put the QueryHeader element directly into the soap header. Note the two different namespaces for QueryHeader and fetchSize.

marian
Champ in-the-making
Champ in-the-making
I got it working now.

So did I thanks to your sample header.

So to answer my further questions:

The query() returns a result where the TotalRows member is set to the
size of the batch or less. It does NOT contain information on how many
rows to expect, only how many are in the current response.

The QuerySession-Member will be set only if there are more rows to be
fetched by a call to fetchMore().

The same is true of fetchMore(): The QuerySession it returns is valid for
the next call to fetchMore() or empty, indicating that all results have been
fetched.

This is all strictly by observation, not based on deeper digging in the code.
I would still appreciate a pointer to some documentation to substanciate
these observations.

But other than that it works for me fine now.

Thank you.

Ciao, MM