Last active
August 29, 2015 13:58
-
-
Save ilgrosso/10097094 to your computer and use it in GitHub Desktop.
Invoking V3 FunctionImport via Olingo4 client library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Edm edm = getClient().getRetrieveRequestFactory(). | |
getMetadataRequest(testStaticServiceRootURL).execute().getBody(); | |
EdmFunction func = edm.getUnboundFunction("GetPrimitiveString", null); | |
EdmEntityContainer container = edm.getSchemas().get(0).getEntityContainer(); | |
URIBuilder builder = getClient().getURIBuilder(testStaticServiceRootURL). | |
appendOperationCallSegment(URIUtils.operationImportURISegment(container, func.getName())); | |
ODataProperty property = getClient().getInvokeRequestFactory(). | |
getInvokeRequest(builder.build(), func).execute().getBody(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lines 1:2 - get metadata - this step can be cached for multiple invocations
Line 4 - via metadata, get to the function to be invoked through function import
Line 6:7 - get entity container for the given metadata and use
URIBuilder
as facility for building the invoke URI for the function import - these two steps are optional if one wants to provide directly the full URL in the subsequent statement, in place ofbuilder.build()
Lines 10:11 - an invoke request is obtained, and result is taken as
ODataProperty