You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Khare, Aparna" <ap...@sap.com> on 2014/03/14 11:44:22 UTC

How to set the service root in Olingo

Hello Team,

   Please can you help us with the issue we are facing :-

I have a edm file and I'm able to create an EDMprovider from that.

The edmx will have a URL which is a string field .

In my application I would want to get the service root from the string url

Eq:-
http://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$orderby=name
_______________________________________/ __________________/  _________________/
                   |                                |                    |
             service root URI                  resource path        query options

Can you please help us with this.

I would have to read the service root ,resource path and key property in case of a PUT (http://services.odata.org/V3/Northwind/Northwind.svc/Categories(1))


Thanks and Regards,
Aparna

Re: How to set the service root in Olingo

Posted by "Bolz, Michael" <mi...@sap.com>.
Hi Apama,

If I understand your question you are looking for a way to parse a given String into a PathInfo object to get the root URI of the service?

If yes, there is currently no support for this use case.
If no, you get the service root URI via "ODataContext -> PathInfo -> getServiceRoot()" as shown in the examples below: 

ODataContext context;
PathInfo pathInfo = context.getPathInfo();

pathInfo.getServiceRoot()
=> http://services.odata.org/OData/OData.svc/

pathInfo.getRequestUri()
=> http://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$orderby=name

pathInfo.getServiceRoot().relativize(pathInfo.getRequestUri()
=> Category(1)/Products?$top=2&$orderby=name

pathInfo.getServiceRoot().relativize(pathInfo.getRequestUri()).getPath()
=> Category(1)

Kind regards,
Michael

On 14.03.2014, at 11:44, Khare, Aparna <ap...@sap.com> wrote:

> Hello Team,
> 
>   Please can you help us with the issue we are facing :-
> 
> I have a edm file and I'm able to create an EDMprovider from that.
> 
> The edmx will have a URL which is a string field .
> 
> In my application I would want to get the service root from the string url
> 
> Eq:-
> http://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$orderby=name
> _______________________________________/ __________________/  _________________/
>                   |                                |                    |
>             service root URI                  resource path        query options
> 
> Can you please help us with this.
> 
> I would have to read the service root ,resource path and key property in case of a PUT (http://services.odata.org/V3/Northwind/Northwind.svc/Categories(1))
> 
> 
> Thanks and Regards,
> Aparna


RE: How to set the service root in Olingo

Posted by "Khare, Aparna" <ap...@sap.com>.
Hello Team,

   I have an ODATA service which takes in the URL and the URL is another OData service 

Example of URL in ODATA Service:-
(http://services.odata.org/V3/Northwind/Northwind.svc/Categories(1))

Now I try to make a $metadata call using above URL and parse the EDM and would prepare a hash map for making a writeEntry() call
>From the URL like given above  I should be able to get the service root, navigation property and key properties .
Can you please help how we can address this using the Olingo Api's

Thanks and Regards,
Aparna

-----Original Message-----
From: Klevenz, Stephan [mailto:stephan.klevenz@sap.com] 
Sent: Friday, March 14, 2014 4:40 PM
To: dev@olingo.incubator.apache.org
Subject: Re: How to set the service root in Olingo

Can you please explain your use case a little bit more in detail?

If you want to implement a ODataSingleProcessor then all detailed uri
information is already available:

a) Service root -> via ODataContext which is available in processor
instance
b) OData uri -> via the UriInfo object that is given to each processor
method

Is this what you want?

-- Stephan



On 14.03.14 11:44, "Khare, Aparna" <ap...@sap.com> wrote:

>Hello Team,
>
>   Please can you help us with the issue we are facing :-
>
>I have a edm file and I'm able to create an EDMprovider from that.
>
>The edmx will have a URL which is a string field .
>
>In my application I would want to get the service root from the string url
>
>Eq:-
>http://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$ord
>erby=name
>_______________________________________/ __________________/
>_________________/
>                   |                                |                    |
>             service root URI                  resource path        query
>options
>
>Can you please help us with this.
>
>I would have to read the service root ,resource path and key property in
>case of a PUT 
>(http://services.odata.org/V3/Northwind/Northwind.svc/Categories(1))
>
>
>Thanks and Regards,
>Aparna


Re: How to set the service root in Olingo

Posted by "Klevenz, Stephan" <st...@sap.com>.
Can you please explain your use case a little bit more in detail?

If you want to implement a ODataSingleProcessor then all detailed uri
information is already available:

a) Service root -> via ODataContext which is available in processor
instance
b) OData uri -> via the UriInfo object that is given to each processor
method

Is this what you want?

-- Stephan



On 14.03.14 11:44, "Khare, Aparna" <ap...@sap.com> wrote:

>Hello Team,
>
>   Please can you help us with the issue we are facing :-
>
>I have a edm file and I'm able to create an EDMprovider from that.
>
>The edmx will have a URL which is a string field .
>
>In my application I would want to get the service root from the string url
>
>Eq:-
>http://services.odata.org/OData/OData.svc/Category(1)/Products?$top=2&$ord
>erby=name
>_______________________________________/ __________________/
>_________________/
>                   |                                |                    |
>             service root URI                  resource path        query
>options
>
>Can you please help us with this.
>
>I would have to read the service root ,resource path and key property in
>case of a PUT 
>(http://services.odata.org/V3/Northwind/Northwind.svc/Categories(1))
>
>
>Thanks and Regards,
>Aparna