Search code examples
javaodataolingo

How to implement an entity bound odata action in olingo v4.3


Similar to this post, I'm trying to implement an action bound to an entity

How to create a bounded action in Olingo V4 (java)

but I get a 500 with no error logged when I GET the metadata document.

In the answer to the above linked question, there is no mention of the getActionImport() implementation that is described in the olingo tutorial, and I wonder if this needs to be modified for an entity-bound action?

How can I get olingo to log the error that is causing the 500?


Solution

  • Getting the debug output is actually quite easy:

    handler.register(new DefaultDebugSupport());

    where handler is a ODataHttpHandler

    Armed with this, and after examination of the olingo-server-core code, I discovered:

    1. You don't need an ActionImport at all for bound actions.
    2. The action name in the URL needs to be qualified with the namespace, as https://issues.oasis-open.org/browse/ODATA-812 has not been implemented.
    3. When I built the client URL using org.apache.olingo.client.api.uri.URIBuilder, it wrapped the entity ID in single quotes, and then olingo server threw an exception, so I reverted to using a StringBuilder