[ 
https://issues.apache.org/jira/browse/CAMEL-13008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16724447#comment-16724447
 ] 

Paul Richardson commented on CAMEL-13008:
-----------------------------------------

So couple of things to consider:
 * 
[L199|https://github.com/apache/camel/blob/44dacd6a5528c85c31c8a3de708ddeb0e7e4b52b/components/camel-olingo4/camel-olingo4-api/src/main/java/org/apache/camel/component/olingo4/api/impl/Olingo4AppImpl.java#L199]
 only handles trailing forward slashes at the end of the service uri and not 
the whole uri. The whole uri is not constructed until 
[L781|https://github.com/apache/camel/blob/44dacd6a5528c85c31c8a3de708ddeb0e7e4b52b/components/camel-olingo4/camel-olingo4-api/src/main/java/org/apache/camel/component/olingo4/api/impl/Olingo4AppImpl.java#L781],
 where the service uri, resource name and query options are concatenated 
together, eg.

{code:java}
ServiceURI (as seen at L199) -> http://192.168.88.5:8090/odata4/Products.svc
Method Name (Resource) -> Products
QueryOptions -> $filter=FirstName eq 'Scott'

Full URI built at L781 (note the '/?' added after '/Products'):
http://192.168.88.5:8090/odata4/Products.svc/Products/?$filter=FirstName eq 
'Scott'
{code}
 
 * The test you've added uses the 
[reference|https://services.odata.org/TripPinRESTierService/(S(4gus0w41xmxedlzbywj2srqo))/People/?$filter=FirstName%20eq%20%27Scott%27]
 odata service, which handles trailing slashes correctly. If you construct a 
test server based on the olingo4 
[tutorial|https://olingo.apache.org/doc/odata4/tutorials/read/tutorial_read.html],
 it will fail. If you would like to run up an existing implementation then feel 
free to copy the one I have created 
[here|https://github.com/phantomjinx/syndesis/blob/odata-connector-wip/app/connector/odata/src/test/java/io/syndesis/connector/odata/server/ODataTestServer.java].

 

The issue to reflect upon is the assumption of adding a slash with the question 
mark at L781. Obviously, some odata services will handle it but just in testing 
I have found that olingo's own tutorial and implementations of teiid both throw 
an error. There could well be many more odata services already deployed that 
would also fail in this fashion. Thus, maybe the slash should be removed 
entirely or a test done to check whether the slash is supported then acted on 
accordingly.

> Odata-connector assumes '/' at end of URI
> -----------------------------------------
>
>                 Key: CAMEL-13008
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13008
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-olingo4
>    Affects Versions: 2.21.0
>            Reporter: Paul Richardson
>            Assignee: Dmitry Volodin
>            Priority: Major
>
> An issue comes to light when testing certain odata implementations that do 
> not handle a '/' being added to the end of the consumed URI, eg.
> * Implementation of the olingo4 
> [tutorial|https://olingo.apache.org/doc/odata4/tutorials/read/tutorial_read.html]
> * Services deployed using current implementations of [teiid|http://teiid.io/]
> Use of the odata-connector on these services results in a _malformed URI_ 
> error.
> Essentially, when the service URI is concatenated with the resource path, the 
> constructed URI is 
> [appended|https://github.com/apache/camel/blob/master/components/camel-olingo4/camel-olingo4-api/src/main/java/org/apache/camel/component/olingo4/api/impl/Olingo4AppImpl.java#L781]
>  with a '/' and a '?' prior to the addition of the query parameters.
> This works fine for the reference odata 
> [implementation|https://services.odata.org/TripPinRESTierService/(S(4gus0w41xmxedlzbywj2srqo))/People/?$filter=FirstName%20eq%20%27Scott%27]
>  since can handle the extra '/'.
> Since both teiid and the olingo4 tutorial use the olingo4 libraries, it would 
> seem that the problem might be solved with them. However, it might be 
> advantageous, given odata implementations already deployed, whether this 
> odata-connector might check whether the '/' was supported before appending it?
> (note. a bug [report|https://issues.jboss.org/browse/TEIID-5573] has been 
> logged with the teiid project to this affect).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to