I have successfully used the REST api to modify an xml datastream,
i.e., with control type X.
I am unsuccessfully, however, trying to use the REST api to modify a
datastream with control type E. So, calling the rest service with a
url like:
http://localhost:8080/fedora/objects/inu:inu-mntb-0000123456-pg-6ae567b8-9cef-4668-96bd-d43cb64c3491/datastreams/OCR_XML?dsLocation=http://someserver.edu/archive/mntb/kfiles/2008/0000123456/0000123456-00000162-001/xml/1593221_0030.xml&controlGroup=E&logMessage=Update&dsLabel=OCR%20XML%20File
I tried to follow the documentation as described here: http://fedora-commons.org/confluence/display/FCR30/Fedora+REST+API#FedoraRESTAPI-modifyDatastream
to construct the url.
The status I get back from the server for that call is 500 (internal
error). I've also tried urls without the dsLabel, logMessage, and
controlGroup, but same error.
the error that shows up in fedora/tomcat/logs/catalina.out is:
javax.ws.rs.WebApplicationException: java.lang.NullPointerException
at
fedora
.server.rest.BaseRestResource.handleException(BaseRestResource.java:98)
at
fedora
.server
.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:
417)
at
fedora
.server
.rest.DatastreamResource.modifyDatastream(DatastreamResource.java:268)
at sun.reflect.GeneratedMethodAccessor185.invoke(Unknown Source)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
com.sun.ws.rest.impl.model.method.dispatch.EntityParamDispatchProvider
$ResponseOutInvoker._dispatch(EntityParamDispatchProvider.java:128)
at
com
.sun
.ws
.rest
.impl
.model
.method
.dispatch
.ResourceJavaMethodDispatcher
.dispatch(ResourceJavaMethodDispatcher.java:65)
at
com
.sun.ws.rest.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:
118)
at
com
.sun
.ws
.rest.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:96)
at
com
.sun
.ws
.rest.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:56)
at
com
.sun
.ws
.rest.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:96)
at
com
.sun
.ws
.rest
.impl
.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:
49)
at
com
.sun
.ws
.rest
.impl
.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:
416)
at
com
.sun
.ws
.rest
.spi.container.servlet.ServletContainer.service(ServletContainer.java:
151)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
269)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
fedora
.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:
235)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
fedora
.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:
235)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
fedora
.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:
235)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org
.apache
.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
213)
at
org
.apache
.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
174)
at
org
.apache
.catalina
.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at
org
.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org
.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
117)
at
org
.apache
.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
174)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
874)
at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at
org
.apache
.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at
org
.apache
.tomcat
.util
.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
81)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
at
fedora
.server
.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:
399)
... 38 more
And in the fedora.log I see what I think is an associated error:
ERROR 2008-12-16 12:27:19.728 [http-8080-Processor25]
(DatastreamResource) java.lang.NullPointerException
but just that single line.
I thought I'd start by looking at line 417 of
fedora.server.rest.DatastreamResource.addOrUpdateDatastream, but I
can't find the source code for the REST api on sourceforge, although
I'm probably looking in the wrong place:
http://fedora-commons.svn.sourceforge.net/viewvc/fedora-commons/fedora/tags/release-3.1/src/java/fedora/server/
I also notice that in the test class, there doesn't seem to be a test
for this specific call, i.e., in:
http://fedora-commons.svn.sourceforge.net/viewvc/fedora-commons/fedora/tags/release-3.1/src/test/junit/fedora/test/api/TestRESTAPI.java
If someone could suggest what I might be doing wrong with the REST
call, or could point to where I could find the source code for the
REST api, it would be much appreciated.
thanks,
james
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Fedora-commons-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fedora-commons-developers