[daisy] Error inserting document via HTTP API

Luca Morandini luca.morandini1 at gmail.com
Fri Sep 14 12:43:19 CDT 2007


Folks,

sorry for bothering you with such a silly thing, but I am unable to 
insert a document into my Daisy 2.0.1 repo with HTTP (I'm using
the fikin-ant-tasks library to manipulate the repo within Ant).

I have a rather simple documentType (two string fields, one HTML part):

1) XML document describing the documentType:
<?xml version="1.0"?>
<ns:document xmlns:ns="http://outerx.org/daisy/1.0"
   name="Test boat page"
   typeId="13"
   owner="103"
   validateOnSave="true"
   newVersionState="publish"
   retired="false"
   private="false"
   branchId="1"
   languageId="1">

   <ns:customFields/>
   <ns:collectionIds>
     <ns:collectionId>1</ns:collectionId>
   </ns:collectionIds>
   <ns:fields>
     <ns:field typeId="16" dataRef="port"/>
     <ns:field typeId="18" dataRef="name"/>
   </ns:fields>
   <ns:parts>
     <ns:part mimeType="text/xml" typeId="7" dataRef="content"/>
   </ns:parts>
   <ns:links/>
</ns:document>

2) Content file:
<?xml version="1.0"?>
<html>
   <head/>
   <body>
     <h1>Boat test 1 content</h1>
   </body>
</html>

3) Ant target:
   <target name="insert-doc-test" description="Inserts a new Daisy doc 
into the repo via HTTP API">
     <httpmpost url="${daisy.repositoryuri}/document" loglevel="all">
       <userCredentials username="${daisy.user}" 
password="${daisy.password}"
         domain="daisy" host="${app.client2appserver}" type="basic"/>
       <postFile name="xml"
         file="${app.dir}/conf/daisyTypes/boat.xml" 
contentType="text/xml" />
       <postString name="port" value="Porto Nuovo di Ventotene"/>
       <postString name="name" value="TestBoat1"/>
       <postFile name="content"
         file="${app.dir}/boat-content.xml" contentType="text/xml" />
     </httpmpost>
   </target>

(please, note that I'm using multipart post here).


It should work, right ? But, instead, I get:

<2007-09-14 13:33:12,051> 
(daisy.repository.httpconnector.request-errors): Error processing 
request /document
java.lang.IndexOutOfBoundsException
         at 
org.outerx.daisy.x10.impl.FieldValuesTypeImpl.getStringArray(Unknown Source)
         at 
org.outerj.daisy.repository.FieldHelper$9.getValue(FieldHelper.java:263)
         at 
org.outerj.daisy.repository.FieldHelper$AbstractFieldValueGetter.getValue(FieldHelper.java:253)
         at 
org.outerj.daisy.repository.FieldHelper.getFieldValueFromXml(FieldHelper.java:117)
         at 
org.outerj.daisy.httpconnector.handlers.AbstractDocumentHandler.updateDocument(AbstractDocumentHandler.java:122)
         at 
org.outerj.daisy.httpconnector.handlers.DocumentsHandler.handleRequest(DocumentsHandler.java:61)
         at 
org.outerj.daisy.httpconnector.HttpConnectorImpl$PathHandler.handle(HttpConnectorImpl.java:299)
         at 
org.outerj.daisy.httpconnector.HttpConnectorImpl$DaisyHandler.handle(HttpConnectorImpl.java:257)


Any clue ?

Regards,

--------------------
    Luca Morandini
www.lucamorandini.it
--------------------


More information about the daisy mailing list