Rangel, Minnie | 1 Aug 23:06 2012
Picon

[fcrepo-user] Errors using findObjects with Soap API-A

Hi,

I have been banging my head against my keyboard for the last couple of days so I am hoping someone out there has
tried this and has a solution.

Background:

I have ingested a whole bunch of test/sample files into Fedora 3.6 but now I have hundreds of things in there
and need to clean it up.  Earlier I was just using the web administrator to purge individual objects but that
is not an adequate solution when you have hundreds of objects (maybe even 1000).

Then I wrote a small php script that would purge objects if I fed it the PID...works great if you have a list of
PIDs to feed it.

My issue:

I was hoping to use findObjects to generate such a list but haven't been able to make it work.

Here is what I have:

	$options = array(
		'login' => $usr,
		'password' => $pwd
	) ;

	$apia =  <at> new SoapClient('http://myserver/fedora/wsdl?api=API-A', $options);

	$opts = array(
		'resultFields' => array('pid', 'label'),
		'maxResults'   => 300,
(Continue reading)

McTernan, Conor | 2 Aug 08:11 2012

[fcrepo-user] Rest addDatastream and UTF-8

I am experiencing some troubles adding some datastreams to my objects where the datastreams have filenames containing multibyte characters.

 

I have a series of PDF documents which I want to add to multiple objects as datastreams, a number of these PDF’s have filenames containing Japanese characters. I am constructing a URI and then posting that URI to my Fedora instance. An example of one of my URI’s would be:

 

http://192.168.10.65:8080/fedora/objects/UNU:720/datastreams/%E6%97%A5%E6%9C%AC%E8%AA%9E-Test.pdf?controlGroup=M&dsLabel=My%20PDF%20Label&versionable=false&mimeType=application%2Fpdf&dsLocation=http%3A%2F%2Flocalhost%2Fingest%2F%E6%97%A5%E6%9C%AC%E8%AA%9E-Test.pdf

 

I am using CURL and PHP to perform the POST. In this example the file name is 日本語-test.pdf. When I POST this URI to the fedora instance I get the following error:

 

javax.ws.rs.WebApplicationException: org.fcrepo.server.errors.HttpServiceNotFoundException: [DefaultExternalContentManager] re                 turned an error.  The underlying error was a org.fcrepo.server.errors.GeneralException  The message was  "Error getting http://localhost/ing                 est/日本語-Test.pdf"  .

        at org.fcrepo.server.rest.BaseRestResource.handleException(BaseRestResource.java:172)

        at org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:583)

        at org.fcrepo.server.rest.DatastreamResource.addDatastream(DatastreamResource.java:358)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:597)

        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractReso                 urceMethodDispatchProvider.java:175)

        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)

        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:163)

        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)

        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)

        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)

        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)

        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:689)

        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:647)

        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:638)

        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)

        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:425)

        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:590)

        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at org.fcrepo.server.security.servletfilters.FilterRestApiFlash.doFilter(FilterRestApiFlash.java:79)

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)

        at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)

        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

        at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)

        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

        at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)

        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

        at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)

        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

        at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:109)

        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)

        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)

        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)

        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)

        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)

        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

        at java.lang.Thread.run(Thread.java:619)

Caused by: org.fcrepo.server.errors.HttpServiceNotFoundException: [DefaultExternalContentManager] returned an error.  The underlying error w                 as a org.fcrepo.server.errors.GeneralException  The message was  "Error getting http://localhost/ingest/日本語-Test.pdf"  .

        at org.fcrepo.server.storage.DefaultExternalContentManager.getExternalContent(DefaultExternalContentManager.java:155)

        at org.fcrepo.server.storage.DefaultDOManager.doCommit(DefaultDOManager.java:1203)

        at org.fcrepo.server.storage.SimpleDOWriter.commit(SimpleDOWriter.java:509)

        at org.fcrepo.server.management.DefaultManagement.modifyDatastreamByReference(DefaultManagement.java:790)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

        at java.lang.reflect.Method.invoke(Method.java:597)

        at org.fcrepo.server.messaging.NotificationInvocationHandler.invoke(NotificationInvocationHandler.java:68)

        at $Proxy4.modifyDatastreamByReference(Unknown Source)

        at org.fcrepo.server.management.ManagementModule.modifyDatastreamByReference(ManagementModule.java:378)

        at org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:527)

        ... 50 more

Caused by: org.fcrepo.server.errors.GeneralException: Error getting http://localhost/ingest/日本語-Test.pdf

        at org.fcrepo.server.storage.DefaultExternalContentManager.get(DefaultExternalContentManager.java:184)

        at org.fcrepo.server.storage.DefaultExternalContentManager.getFromWeb(DefaultExternalContentManager.java:326)

        at org.fcrepo.server.storage.DefaultExternalContentManager.getExternalContent(DefaultExternalContentManager.java:149)

        ... 61 more

Caused by: java.lang.IllegalArgumentException: Invalid uri 'http://localhost/ingest/日本語-Test.pdf': escaped absolute path not valid

        at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)

        at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)

        at org.fcrepo.common.http.WebClient.get(WebClient.java:163)

        at org.fcrepo.common.http.WebClient.get(WebClient.java:136)

        at org.fcrepo.server.storage.DefaultExternalContentManager.get(DefaultExternalContentManager.java:172)

 

 

I have already set URIEncoding to UTF-8 in my server.xml and if I submit a different document without multibyte characters in their filename I have no problems. The main problem appears to be when Fedora attempts to actuire the datastream from the dsLocation provided. In this example if I attempt to connect to http://localhost/ingest/日本語-Test.pdf (via wget or links) I have no problem.

 

I have been searching through the archives and various other sites and the only piece of advice I have found is to configure URIEncoding. All my server locale values are set to UTF-8 and my JAVA_OPTS value includes -Dfile.encoding=UTF-8

 

Cheers,

 

Conor

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@...
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
Jörg Knappen | 2 Aug 10:35 2012
Picon

Re: [fcrepo-user] Errors using findObjects with Soap API-A

You can use the buildt-in oai provider to get a list of all objects;  
the following http request will give you an XML file containing all  
the dc metadata including the id's:

http://your-host.name/path-to-fedora/oai?verb=ListRecords&metadataPrefix=oai_dc

The id's are found in the <identifier> elements:

<identifier>oai:yourhost.name:prefix:suffix</identifier>

and consist of prefix:suffix

Hope this helps.

--Jörg Knappen

Zitat von "Rangel, Minnie" <mrangel@...>:

> Hi,
>
> I have been banging my head against my keyboard for the last couple  
> of days so I am hoping someone out there has tried this and has a  
> solution.
>
> Background:
>
> I have ingested a whole bunch of test/sample files into Fedora 3.6  
> but now I have hundreds of things in there and need to clean it up.   
> Earlier I was just using the web administrator to purge individual  
> objects but that is not an adequate solution when you have hundreds  
> of objects (maybe even 1000).
>
> Then I wrote a small php script that would purge objects if I fed it  
> the PID...works great if you have a list of PIDs to feed it.
>
> My issue:
>
> I was hoping to use findObjects to generate such a list but haven't  
> been able to make it work.
>
> Here is what I have:
>
> 	$options = array(
> 		'login' => $usr,
> 		'password' => $pwd
> 	) ;
>
> 	$apia =  <at> new SoapClient('http://myserver/fedora/wsdl?api=API-A', $options);
>
> 	$opts = array(
> 		'resultFields' => array('pid', 'label'),
> 		'maxResults'   => 300,
> 		'query'        => 'label eq SearchTerm',
> 	);
>
> (line 26)	$r = $apia->findObjects( $opts );
>
> 	foreach ( $r->result->resultList->objectFields as $o ) {
> 		printf("%-36s %-12s %s\n", $o->pid, $o->label);
> 	}
>
> I tried the query also as
> 		'query'        => 'SearchTerm',
> 		'label'        => 'SearchTerm',
>
> But all give errors
> 'label' gave a "no query" error so I gave up on that route.
>
> But the other methods give the following error
>
> PHP Fatal error:  Uncaught SoapFault exception: [soap:Client]  
> java.lang.NullPointerException Caused by: Uncaught exception from  
> Fedora Server in /home/mrangel/fedora-php/findObjects.php:24
> Stack trace:
> #0 /home/mrangel/fedora-php/findObjects.php(24):  
> SoapClient->__call('findObjects', Array)
> #1 /home/mrangel/fedora-php/findObjects.php(24):  
> SoapClient->findObjects(Array)
> #2 {main}
>   thrown in /home/mrangel/fedora-php/findObjects.php on line 26
>
> adding the Try/Catch loop gives (wasn't very helpful)
>
> PHP Fatal error:  soap:Client, java.lang.NullPointerException Caused  
> by: Uncaught exception from Fedora Server in  
> /home/mrangel/fedora-php/findObjects.php on line 36
>
> Line 36 is the catch trigger_error part so it wasn't helpful that is  
> why I took it out of the loop to see what it would give.
>
> Any ideas???
>
> Thanks for any help,
> Minnie
> mrangel@...
> Library Systems - Software Developer
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Fedora-commons-users mailing list
> Fedora-commons-users@...
> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Benjamin Armintor | 2 Aug 15:27 2012
Picon

Re: [fcrepo-user] Rest addDatastream and UTF-8

Conor-
  Just to confirm, are you running Fedora 3.5?

- Ben

On Thu, Aug 2, 2012 at 2:11 AM, McTernan, Conor <mcternan <at> unu.edu> wrote:
> I am experiencing some troubles adding some datastreams to my objects where
> the datastreams have filenames containing multibyte characters.
>
>
>
> I have a series of PDF documents which I want to add to multiple objects as
> datastreams, a number of these PDF’s have filenames containing Japanese
> characters. I am constructing a URI and then posting that URI to my Fedora
> instance. An example of one of my URI’s would be:
>
>
>
> http://192.168.10.65:8080/fedora/objects/UNU:720/datastreams/%E6%97%A5%E6%9C%AC%E8%AA%9E-Test.pdf?controlGroup=M&dsLabel=My%20PDF%20Label&versionable=false&mimeType=application%2Fpdf&dsLocation=http%3A%2F%2Flocalhost%2Fingest%2F%E6%97%A5%E6%9C%AC%E8%AA%9E-Test.pdf
>
>
>
> I am using CURL and PHP to perform the POST. In this example the file name
> is 日本語-test.pdf. When I POST this URI to the fedora instance I get the
> following error:
>
>
>
> javax.ws.rs.WebApplicationException:
> org.fcrepo.server.errors.HttpServiceNotFoundException:
> [DefaultExternalContentManager] re                 turned an error.  The
> underlying error was a org.fcrepo.server.errors.GeneralException  The
> message was  "Error getting http://localhost/ing
> est/日本語-Test.pdf"  .
>
>         at
> org.fcrepo.server.rest.BaseRestResource.handleException(BaseRestResource.java:172)
>
>         at
> org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:583)
>
>         at
> org.fcrepo.server.rest.DatastreamResource.addDatastream(DatastreamResource.java:358)
>
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>         at java.lang.reflect.Method.invoke(Method.java:597)
>
>         at
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractReso
> urceMethodDispatchProvider.java:175)
>
>         at
> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>
>         at
> com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:163)
>
>         at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
>
>         at
> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
>
>         at
> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
>
>         at
> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
>
>         at
> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:689)
>
>         at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:647)
>
>         at
> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:638)
>
>         at
> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
>
>         at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:425)
>
>         at
> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:590)
>
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
>         at
> org.fcrepo.server.security.servletfilters.FilterRestApiFlash.doFilter(FilterRestApiFlash.java:79)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
>         at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
>
>         at
> org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
>
>         at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
>
>         at
> org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
>
>         at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
>
>         at
> org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
>
>         at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
>
>         at
> org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
>
>         at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
>
>         at
> org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:109)
>
>         at
> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
>
>         at
> org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
>
>         at
> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
>
>         at
> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
>
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>
>         at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>
>         at java.lang.Thread.run(Thread.java:619)
>
> Caused by: org.fcrepo.server.errors.HttpServiceNotFoundException:
> [DefaultExternalContentManager] returned an error.  The underlying error w
> as a org.fcrepo.server.errors.GeneralException  The message was  "Error
> getting http://localhost/ingest/日本語-Test.pdf"  .
>
>         at
> org.fcrepo.server.storage.DefaultExternalContentManager.getExternalContent(DefaultExternalContentManager.java:155)
>
>         at
> org.fcrepo.server.storage.DefaultDOManager.doCommit(DefaultDOManager.java:1203)
>
>         at
> org.fcrepo.server.storage.SimpleDOWriter.commit(SimpleDOWriter.java:509)
>
>         at
> org.fcrepo.server.management.DefaultManagement.modifyDatastreamByReference(DefaultManagement.java:790)
>
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
>         at java.lang.reflect.Method.invoke(Method.java:597)
>
>         at
> org.fcrepo.server.messaging.NotificationInvocationHandler.invoke(NotificationInvocationHandler.java:68)
>
>         at $Proxy4.modifyDatastreamByReference(Unknown Source)
>
>         at
> org.fcrepo.server.management.ManagementModule.modifyDatastreamByReference(ManagementModule.java:378)
>
>         at
> org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:527)
>
>         ... 50 more
>
> Caused by: org.fcrepo.server.errors.GeneralException: Error getting
> http://localhost/ingest/日本語-Test.pdf
>
>         at
> org.fcrepo.server.storage.DefaultExternalContentManager.get(DefaultExternalContentManager.java:184)
>
>         at
> org.fcrepo.server.storage.DefaultExternalContentManager.getFromWeb(DefaultExternalContentManager.java:326)
>
>         at
> org.fcrepo.server.storage.DefaultExternalContentManager.getExternalContent(DefaultExternalContentManager.java:149)
>
>         ... 61 more
>
> Caused by: java.lang.IllegalArgumentException: Invalid uri
> 'http://localhost/ingest/日本語-Test.pdf': escaped absolute path not valid
>
>         at
> org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)
>
>         at
> org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
>
>         at org.fcrepo.common.http.WebClient.get(WebClient.java:163)
>
>         at org.fcrepo.common.http.WebClient.get(WebClient.java:136)
>
>         at
> org.fcrepo.server.storage.DefaultExternalContentManager.get(DefaultExternalContentManager.java:172)
>
>
>
>
>
> I have already set URIEncoding to UTF-8 in my server.xml and if I submit a
> different document without multibyte characters in their filename I have no
> problems. The main problem appears to be when Fedora attempts to actuire the
> datastream from the dsLocation provided. In this example if I attempt to
> connect to http://localhost/ingest/日本語-Test.pdf (via wget or links) I have
> no problem.
>
>
>
> I have been searching through the archives and various other sites and the
> only piece of advice I have found is to configure URIEncoding. All my server
> locale values are set to UTF-8 and my JAVA_OPTS value includes
> -Dfile.encoding=UTF-8
>
>
>
> Cheers,
>
>
>
> Conor
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Fedora-commons-users mailing list
> Fedora-commons-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
Chris Wilper | 2 Aug 16:26 2012

Re: [fcrepo-user] Rest addDatastream and UTF-8

Hi Conor,

Can you try this URL for the REST call instead?

http://192.168.10.65:8080/fedora/objects/UNU:720/datastreams/%E6%97%A5%E6%9C%AC%E8%AA%9E-Test.pdf?controlGroup=M&dsLabel=My%20PDF%20Label&versionable=false&mimeType=application%2Fpdf&dsLocation=http%3A%2F%2Flocalhost%2Fingest%2F%25E6%2597%25A5%25E6%259C%25AC%25E8%25AA%259E-Test.pdf

Explanation:

Since multi-byte characters cannot appear directly in URIs, the actual
legal URI of the content is
http://localhost/ingest/%E6%97%A5%E6%9C%AC%E8%AA%9E-Test.pdf ...not
http://localhost/ingest/日本語-Test.pdf  -- If the latter works when you
type it in your browser, that's because your browser is automatically
translating those multi-byte characters to their URI-encoded
equivalents before making the http request.

Bottom line is that the former value (with the encoded multi-byte
characters) should be given as the dsLocation value in the REST call.
In addition, and as a separate concern, in order to make the REST call
to Fedora, the value of the dsLocation URL parameter needs to be
URI-encoded. The URI-encoded dsLocation value would be

http%3A%2F%2Flocalhost%2Fingest%2F%25E6%2597%25A5%25E6%259C%25AC%25E8%25AA%259E-Test.pdf

...which makes the full URI of the Fedora REST call as given above. In
effect, those multi-byte characters need to be doubly URI-encoded.
Once because they're multi-byte and appear in a URI, and again because
that URI needs to be passed as an argument in another URI.

Hopefully this explains + resolves the issue. Can you give it a try
and report your result?

Thanks,
Chris

On Thu, Aug 2, 2012 at 9:27 AM, Benjamin Armintor <armintor <at> gmail.com> wrote:
> Conor-
>   Just to confirm, are you running Fedora 3.5?
>
> - Ben
>
> On Thu, Aug 2, 2012 at 2:11 AM, McTernan, Conor <mcternan <at> unu.edu> wrote:
>> I am experiencing some troubles adding some datastreams to my objects where
>> the datastreams have filenames containing multibyte characters.
>>
>>
>>
>> I have a series of PDF documents which I want to add to multiple objects as
>> datastreams, a number of these PDF’s have filenames containing Japanese
>> characters. I am constructing a URI and then posting that URI to my Fedora
>> instance. An example of one of my URI’s would be:
>>
>>
>>
>> http://192.168.10.65:8080/fedora/objects/UNU:720/datastreams/%E6%97%A5%E6%9C%AC%E8%AA%9E-Test.pdf?controlGroup=M&dsLabel=My%20PDF%20Label&versionable=false&mimeType=application%2Fpdf&dsLocation=http%3A%2F%2Flocalhost%2Fingest%2F%E6%97%A5%E6%9C%AC%E8%AA%9E-Test.pdf
>>
>>
>>
>> I am using CURL and PHP to perform the POST. In this example the file name
>> is 日本語-test.pdf. When I POST this URI to the fedora instance I get the
>> following error:
>>
>>
>>
>> javax.ws.rs.WebApplicationException:
>> org.fcrepo.server.errors.HttpServiceNotFoundException:
>> [DefaultExternalContentManager] re                 turned an error.  The
>> underlying error was a org.fcrepo.server.errors.GeneralException  The
>> message was  "Error getting http://localhost/ing
>> est/日本語-Test.pdf"  .
>>
>>         at
>> org.fcrepo.server.rest.BaseRestResource.handleException(BaseRestResource.java:172)
>>
>>         at
>> org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:583)
>>
>>         at
>> org.fcrepo.server.rest.DatastreamResource.addDatastream(DatastreamResource.java:358)
>>
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>>         at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>>         at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>>         at java.lang.reflect.Method.invoke(Method.java:597)
>>
>>         at
>> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractReso
>> urceMethodDispatchProvider.java:175)
>>
>>         at
>> com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
>>
>>         at
>> com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:163)
>>
>>         at
>> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
>>
>>         at
>> com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
>>
>>         at
>> com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
>>
>>         at
>> com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
>>
>>         at
>> com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:689)
>>
>>         at
>> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:647)
>>
>>         at
>> com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:638)
>>
>>         at
>> com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:309)
>>
>>         at
>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:425)
>>
>>         at
>> com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:590)
>>
>>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
>>
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>>
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>
>>         at
>> org.fcrepo.server.security.servletfilters.FilterRestApiFlash.doFilter(FilterRestApiFlash.java:79)
>>
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>
>>         at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
>>
>>         at
>> org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
>>
>>         at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
>>
>>         at
>> org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
>>
>>         at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
>>
>>         at
>> org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
>>
>>         at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
>>
>>         at
>> org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:247)
>>
>>         at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
>>
>>         at
>> org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:109)
>>
>>         at
>> org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
>>
>>         at
>> org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
>>
>>         at
>> org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
>>
>>         at
>> org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
>>
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>>
>>         at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>>
>>         at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
>>
>>         at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>>
>>         at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>>
>>         at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>>
>>         at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>>
>>         at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
>>
>>         at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
>>
>>         at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
>>
>>         at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
>>
>>         at java.lang.Thread.run(Thread.java:619)
>>
>> Caused by: org.fcrepo.server.errors.HttpServiceNotFoundException:
>> [DefaultExternalContentManager] returned an error.  The underlying error w
>> as a org.fcrepo.server.errors.GeneralException  The message was  "Error
>> getting http://localhost/ingest/日本語-Test.pdf"  .
>>
>>         at
>> org.fcrepo.server.storage.DefaultExternalContentManager.getExternalContent(DefaultExternalContentManager.java:155)
>>
>>         at
>> org.fcrepo.server.storage.DefaultDOManager.doCommit(DefaultDOManager.java:1203)
>>
>>         at
>> org.fcrepo.server.storage.SimpleDOWriter.commit(SimpleDOWriter.java:509)
>>
>>         at
>> org.fcrepo.server.management.DefaultManagement.modifyDatastreamByReference(DefaultManagement.java:790)
>>
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>>         at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>>         at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>>         at java.lang.reflect.Method.invoke(Method.java:597)
>>
>>         at
>> org.fcrepo.server.messaging.NotificationInvocationHandler.invoke(NotificationInvocationHandler.java:68)
>>
>>         at $Proxy4.modifyDatastreamByReference(Unknown Source)
>>
>>         at
>> org.fcrepo.server.management.ManagementModule.modifyDatastreamByReference(ManagementModule.java:378)
>>
>>         at
>> org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:527)
>>
>>         ... 50 more
>>
>> Caused by: org.fcrepo.server.errors.GeneralException: Error getting
>> http://localhost/ingest/日本語-Test.pdf
>>
>>         at
>> org.fcrepo.server.storage.DefaultExternalContentManager.get(DefaultExternalContentManager.java:184)
>>
>>         at
>> org.fcrepo.server.storage.DefaultExternalContentManager.getFromWeb(DefaultExternalContentManager.java:326)
>>
>>         at
>> org.fcrepo.server.storage.DefaultExternalContentManager.getExternalContent(DefaultExternalContentManager.java:149)
>>
>>         ... 61 more
>>
>> Caused by: java.lang.IllegalArgumentException: Invalid uri
>> 'http://localhost/ingest/日本語-Test.pdf': escaped absolute path not valid
>>
>>         at
>> org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)
>>
>>         at
>> org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
>>
>>         at org.fcrepo.common.http.WebClient.get(WebClient.java:163)
>>
>>         at org.fcrepo.common.http.WebClient.get(WebClient.java:136)
>>
>>         at
>> org.fcrepo.server.storage.DefaultExternalContentManager.get(DefaultExternalContentManager.java:172)
>>
>>
>>
>>
>>
>> I have already set URIEncoding to UTF-8 in my server.xml and if I submit a
>> different document without multibyte characters in their filename I have no
>> problems. The main problem appears to be when Fedora attempts to actuire the
>> datastream from the dsLocation provided. In this example if I attempt to
>> connect to http://localhost/ingest/日本語-Test.pdf (via wget or links) I have
>> no problem.
>>
>>
>>
>> I have been searching through the archives and various other sites and the
>> only piece of advice I have found is to configure URIEncoding. All my server
>> locale values are set to UTF-8 and my JAVA_OPTS value includes
>> -Dfile.encoding=UTF-8
>>
>>
>>
>> Cheers,
>>
>>
>>
>> Conor
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Fedora-commons-users mailing list
>> Fedora-commons-users <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Fedora-commons-users mailing list
> Fedora-commons-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
Rangel, Minnie | 2 Aug 17:51 2012
Picon

Re: [fcrepo-user] Errors using findObjects with Soap API-A

Thanks for the response,

Unfortunately I am trying to do this all via a php script on the command line, not through a browser and while I
may have to resort to creating the file one way, saving it and feeding it to php to parse, I was hoping to avoid that.

Any other ideas?....

thanks for the help, 
/Minnie

-----Original Message-----
From: Jörg Knappen [mailto:j.knappen@...] 
Sent: Thursday, August 02, 2012 3:35 AM
To: fedora-commons-users@...
Subject: Re: [fcrepo-user] Errors using findObjects with Soap API-A

You can use the buildt-in oai provider to get a list of all objects; the following http request will give you
an XML file containing all the dc metadata including the id's:

http://your-host.name/path-to-fedora/oai?verb=ListRecords&metadataPrefix=oai_dc

The id's are found in the <identifier> elements:

<identifier>oai:yourhost.name:prefix:suffix</identifier>

and consist of prefix:suffix

Hope this helps.

--Jörg Knappen

Zitat von "Rangel, Minnie" <mrangel@...>:

> Hi,
>
> I have been banging my head against my keyboard for the last couple of 
> days so I am hoping someone out there has tried this and has a 
> solution.
>
> Background:
>
> I have ingested a whole bunch of test/sample files into Fedora 3.6  
> but now I have hundreds of things in there and need to clean it up.   
> Earlier I was just using the web administrator to purge individual 
> objects but that is not an adequate solution when you have hundreds of 
> objects (maybe even 1000).
>
> Then I wrote a small php script that would purge objects if I fed it 
> the PID...works great if you have a list of PIDs to feed it.
>
> My issue:
>
> I was hoping to use findObjects to generate such a list but haven't 
> been able to make it work.
>
> Here is what I have:
>
> 	$options = array(
> 		'login' => $usr,
> 		'password' => $pwd
> 	) ;
>
> 	$apia =  <at> new SoapClient('http://myserver/fedora/wsdl?api=API-A', 
> $options);
>
> 	$opts = array(
> 		'resultFields' => array('pid', 'label'),
> 		'maxResults'   => 300,
> 		'query'        => 'label eq SearchTerm',
> 	);
>
> (line 26)	$r = $apia->findObjects( $opts );
>
> 	foreach ( $r->result->resultList->objectFields as $o ) {
> 		printf("%-36s %-12s %s\n", $o->pid, $o->label);
> 	}
>
> I tried the query also as
> 		'query'        => 'SearchTerm',
> 		'label'        => 'SearchTerm',
>
> But all give errors
> 'label' gave a "no query" error so I gave up on that route.
>
> But the other methods give the following error
>
> PHP Fatal error:  Uncaught SoapFault exception: [soap:Client] 
> java.lang.NullPointerException Caused by: Uncaught exception from 
> Fedora Server in /home/mrangel/fedora-php/findObjects.php:24
> Stack trace:
> #0 /home/mrangel/fedora-php/findObjects.php(24):  
> SoapClient->__call('findObjects', Array)
> #1 /home/mrangel/fedora-php/findObjects.php(24):  
> SoapClient->findObjects(Array)
> #2 {main}
>   thrown in /home/mrangel/fedora-php/findObjects.php on line 26
>
> adding the Try/Catch loop gives (wasn't very helpful)
>
> PHP Fatal error:  soap:Client, java.lang.NullPointerException Caused
> by: Uncaught exception from Fedora Server in 
> /home/mrangel/fedora-php/findObjects.php on line 36
>
> Line 36 is the catch trigger_error part so it wasn't helpful that is 
> why I took it out of the loop to see what it would give.
>
> Any ideas???
>
> Thanks for any help,
> Minnie
> mrangel@...
> Library Systems - Software Developer
>
> ----------------------------------------------------------------------
> --------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. 
> Discussions will include endpoint security, mobile security and the 
> latest in malware threats. 
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Fedora-commons-users mailing list
> Fedora-commons-users@...
> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT
managers can respond. Discussions will include endpoint security, mobile security and the latest in
malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@...
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Re: [fcrepo-user] Errors using findObjects with Soap API-A

Do you have the log for the Fedora instance in question available? Can you show what it records at that moment?


---
A. Soroka
Online Library Environment
the University of Virginia Library



On Thu, Aug 2, 2012 at 11:51 AM, Rangel, Minnie <mrangel-H8qjcnOI+J1gYfp1RNbdJ4dd74u8MsAO@public.gmane.org> wrote:
Thanks for the response,

Unfortunately I am trying to do this all via a php script on the command line, not through a browser and while I may have to resort to creating the file one way, saving it and feeding it to php to parse, I was hoping to avoid that.

Any other ideas?....

thanks for the help,
/Minnie

-----Original Message-----
From: Jörg Knappen [mailto:j.knappen-901KwZ2PgullFXlwHl2ejYQuADTiUCJX@public.gmane.org]
Sent: Thursday, August 02, 2012 3:35 AM
To: fedora-commons-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: [fcrepo-user] Errors using findObjects with Soap API-A

You can use the buildt-in oai provider to get a list of all objects; the following http request will give you an XML file containing all the dc metadata including the id's:

http://your-host.name/path-to-fedora/oai?verb=ListRecords&metadataPrefix=oai_dc

The id's are found in the <identifier> elements:

<identifier>oai:yourhost.name:prefix:suffix</identifier>

and consist of prefix:suffix

Hope this helps.

--Jörg Knappen

Zitat von "Rangel, Minnie" <mrangel-H8qjcnOI+J1gYfp1RNbdJ4dd74u8MsAO@public.gmane.org>:

> Hi,
>
> I have been banging my head against my keyboard for the last couple of
> days so I am hoping someone out there has tried this and has a
> solution.
>
> Background:
>
> I have ingested a whole bunch of test/sample files into Fedora 3.6
> but now I have hundreds of things in there and need to clean it up.
> Earlier I was just using the web administrator to purge individual
> objects but that is not an adequate solution when you have hundreds of
> objects (maybe even 1000).
>
> Then I wrote a small php script that would purge objects if I fed it
> the PID...works great if you have a list of PIDs to feed it.
>
> My issue:
>
> I was hoping to use findObjects to generate such a list but haven't
> been able to make it work.
>
> Here is what I have:
>
>       $options = array(
>               'login' => $usr,
>               'password' => $pwd
>       ) ;
>
>       $apia = <at> new SoapClient('http://myserver/fedora/wsdl?api=API-A',
> $options);
>
>       $opts = array(
>               'resultFields' => array('pid', 'label'),
>               'maxResults'   => 300,
>               'query'        => 'label eq SearchTerm',
>       );
>
> (line 26)     $r = $apia->findObjects( $opts );
>
>       foreach ( $r->result->resultList->objectFields as $o ) {
>               printf("%-36s %-12s %s\n", $o->pid, $o->label);
>       }
>
> I tried the query also as
>               'query'        => 'SearchTerm',
>               'label'        => 'SearchTerm',
>
> But all give errors
> 'label' gave a "no query" error so I gave up on that route.
>
> But the other methods give the following error
>
> PHP Fatal error:  Uncaught SoapFault exception: [soap:Client]
> java.lang.NullPointerException Caused by: Uncaught exception from
> Fedora Server in /home/mrangel/fedora-php/findObjects.php:24
> Stack trace:
> #0 /home/mrangel/fedora-php/findObjects.php(24):
> SoapClient->__call('findObjects', Array)
> #1 /home/mrangel/fedora-php/findObjects.php(24):
> SoapClient->findObjects(Array)
> #2 {main}
>   thrown in /home/mrangel/fedora-php/findObjects.php on line 26
>
> adding the Try/Catch loop gives (wasn't very helpful)
>
> PHP Fatal error:  soap:Client, java.lang.NullPointerException Caused
> by: Uncaught exception from Fedora Server in
> /home/mrangel/fedora-php/findObjects.php on line 36
>
> Line 36 is the catch trigger_error part so it wasn't helpful that is
> why I took it out of the loop to see what it would give.
>
> Any ideas???
>
> Thanks for any help,
> Minnie
> mrangel-H8qjcnOI+J1gYfp1RNbdJ4dd74u8MsAO@public.gmane.org
> Library Systems - Software Developer
>
> ----------------------------------------------------------------------
> --------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond.
> Discussions will include endpoint security, mobile security and the
> latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Fedora-commons-users mailing list
> Fedora-commons-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@...
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
Swithun Crowe | 2 Aug 18:24 2012
Picon

Re: [fcrepo-user] Errors using findObjects with Soap API-A

Hello

RM> Unfortunately I am trying to do this all via a php script on the 
RM> command line, not through a browser and while I may have to resort to 
RM> creating the file one way, saving it and feeding it to php to parse, I 
RM> was hoping to avoid that.

You could use the curl module in PHP to get the OAI file, and load it into 
a DOM or SimpleXML object or XML reader and get the IDs in a variety of 
ways.

Curl is slightly fiddly - I have a small function that wraps curl, so that 
it returns the contents of the URL - by default, it sends the URL contents 
straight to STDOUT.

function myCurl($url) {
    $data = "";
    $options = array(CURLOPT_URL => $url,
                     CURLOPT_RETURNTRANSFER => true);

    do {
        $c = curl_init();
        if (!$c) {
            break;
        }

        if (!curl_setopt_array($c, $options)) {
            break;
        }

        $data = curl_exec($c);
        curl_close($c);
    } while (false);

    return $data;
}

Or, if you can use file_get_contents with URLs, then use it instead.

Swithun.

--

-- 
The University of St Andrews is a charity registered in Scotland: SC013532

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Rangel, Minnie | 2 Aug 19:00 2012
Picon

Re: [fcrepo-user] Errors using findObjects with Soap API-A

Thank you, I will try that and see what I get.

/Minnie

-----Original Message-----
From: Swithun Crowe [mailto:cs2@...] 
Sent: Thursday, August 02, 2012 11:24 AM
To: Support and info exchange list for Fedora users.
Subject: Re: [fcrepo-user] Errors using findObjects with Soap API-A

Hello

RM> Unfortunately I am trying to do this all via a php script on the 
RM> command line, not through a browser and while I may have to resort 
RM> to creating the file one way, saving it and feeding it to php to 
RM> parse, I was hoping to avoid that.

You could use the curl module in PHP to get the OAI file, and load it into a DOM or SimpleXML object or XML reader
and get the IDs in a variety of ways.

Curl is slightly fiddly - I have a small function that wraps curl, so that it returns the contents of the URL -
by default, it sends the URL contents straight to STDOUT.

function myCurl($url) {
    $data = "";
    $options = array(CURLOPT_URL => $url,
                     CURLOPT_RETURNTRANSFER => true);

    do {
        $c = curl_init();
        if (!$c) {
            break;
        }

        if (!curl_setopt_array($c, $options)) {
            break;
        }

        $data = curl_exec($c);
        curl_close($c);
    } while (false);

    return $data;
}

Or, if you can use file_get_contents with URLs, then use it instead.

Swithun.

--
The University of St Andrews is a charity registered in Scotland: SC013532

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@...
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Rangel, Minnie | 2 Aug 19:01 2012
Picon

Re: [fcrepo-user] Errors using findObjects with Soap API-A

My sys admin is out so I will try to get a look at the log tomorrow and post it…

 

Thanks for the offer of help.

 

/Minnie

 

From: ajs6f <at> virginia.edu [mailto:ajs6f <at> virginia.edu]
Sent: Thursday, August 02, 2012 11:26 AM
To: Support and info exchange list for Fedora users.
Subject: Re: [fcrepo-user] Errors using findObjects with Soap API-A

 

Do you have the log for the Fedora instance in question available? Can you show what it records at that moment?

 

---

A. Soroka

Online Library Environment

the University of Virginia Library

 

 

On Thu, Aug 2, 2012 at 11:51 AM, Rangel, Minnie <mrangel <at> austin.utexas.edu> wrote:

Thanks for the response,

Unfortunately I am trying to do this all via a php script on the command line, not through a browser and while I may have to resort to creating the file one way, saving it and feeding it to php to parse, I was hoping to avoid that.

Any other ideas?....

thanks for the help,
/Minnie

-----Original Message-----
From: Jörg Knappen [mailto:j.knappen <at> mx.uni-saarland.de]
Sent: Thursday, August 02, 2012 3:35 AM
To: fedora-commons-users <at> lists.sourceforge.net
Subject: Re: [fcrepo-user] Errors using findObjects with Soap API-A

You can use the buildt-in oai provider to get a list of all objects; the following http request will give you an XML file containing all the dc metadata including the id's:

http://your-host.name/path-to-fedora/oai?verb=ListRecords&metadataPrefix=oai_dc

The id's are found in the <identifier> elements:

<identifier>oai:yourhost.name:prefix:suffix</identifier>

and consist of prefix:suffix

Hope this helps.

--Jörg Knappen

Zitat von "Rangel, Minnie" <mrangel <at> austin.utexas.edu>:

> Hi,
>
> I have been banging my head against my keyboard for the last couple of
> days so I am hoping someone out there has tried this and has a
> solution.
>
> Background:
>
> I have ingested a whole bunch of test/sample files into Fedora 3.6
> but now I have hundreds of things in there and need to clean it up.
> Earlier I was just using the web administrator to purge individual
> objects but that is not an adequate solution when you have hundreds of
> objects (maybe even 1000).
>
> Then I wrote a small php script that would purge objects if I fed it
> the PID...works great if you have a list of PIDs to feed it.
>
> My issue:
>
> I was hoping to use findObjects to generate such a list but haven't
> been able to make it work.
>
> Here is what I have:
>
>       $options = array(
>               'login' => $usr,
>               'password' => $pwd
>       ) ;
>
>       $apia = <at> new SoapClient('http://myserver/fedora/wsdl?api=API-A',
> $options);
>
>       $opts = array(
>               'resultFields' => array('pid', 'label'),
>               'maxResults'   => 300,
>               'query'        => 'label eq SearchTerm',
>       );
>
> (line 26)     $r = $apia->findObjects( $opts );
>
>       foreach ( $r->result->resultList->objectFields as $o ) {
>               printf("%-36s %-12s %s\n", $o->pid, $o->label);
>       }
>
> I tried the query also as
>               'query'        => 'SearchTerm',
>               'label'        => 'SearchTerm',
>
> But all give errors
> 'label' gave a "no query" error so I gave up on that route.
>
> But the other methods give the following error
>
> PHP Fatal error:  Uncaught SoapFault exception: [soap:Client]
> java.lang.NullPointerException Caused by: Uncaught exception from
> Fedora Server in /home/mrangel/fedora-php/findObjects.php:24
> Stack trace:
> #0 /home/mrangel/fedora-php/findObjects.php(24):
> SoapClient->__call('findObjects', Array)
> #1 /home/mrangel/fedora-php/findObjects.php(24):
> SoapClient->findObjects(Array)
> #2 {main}
>   thrown in /home/mrangel/fedora-php/findObjects.php on line 26
>
> adding the Try/Catch loop gives (wasn't very helpful)
>
> PHP Fatal error:  soap:Client, java.lang.NullPointerException Caused
> by: Uncaught exception from Fedora Server in
> /home/mrangel/fedora-php/findObjects.php on line 36
>
> Line 36 is the catch trigger_error part so it wasn't helpful that is
> why I took it out of the loop to see what it would give.
>
> Any ideas???
>
> Thanks for any help,
> Minnie
> mrangel <at> austin.utexas.edu
> Library Systems - Software Developer
>
> ----------------------------------------------------------------------
> --------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond.
> Discussions will include endpoint security, mobile security and the
> latest in malware threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Fedora-commons-users mailing list
> Fedora-commons-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/fedora-commons-users
>




------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Fedora-commons-users mailing list
Fedora-commons-users@...
https://lists.sourceforge.net/lists/listinfo/fedora-commons-users

Gmane