You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Thierry Templier (JIRA)" <ji...@apache.org> on 2014/12/08 15:46:12 UTC

[jira] [Commented] (OLINGO-512) Problem when updating a navigation link with cardinality n > 1

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

Thierry Templier commented on OLINGO-512:
-----------------------------------------

After investigating more the issue, I found out that using the method appendEntitySetSegment of the URIBuilder fixes my issue:

URI categoryRef = client.newURIBuilder(serviceRoot)
    .appendEntitySetSegment("Categories").appendKeySegment(2)
    .build();


> Problem when updating a navigation link with cardinality n > 1
> --------------------------------------------------------------
>
>                 Key: OLINGO-512
>                 URL: https://issues.apache.org/jira/browse/OLINGO-512
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-client
>    Affects Versions: V4 4.0.0-beta-01
>         Environment: java version : "1.7.0_72" 
> Odata v4 service : http://services.odata.org/V4/OData/(S(li4s4wcplcgyiy3uvuog1lxl))/OData.svc
>            Reporter: Thierry Templier
>
> I try to update a navigation link of an entity with cardinality n>1 as described below:
> String serviceRoot = (...);
> URI productUri = client.newURIBuilder(serviceRoot)
>     .appendEntitySetSegment("Products")
>     .appendKeySegment(1)
>     .build();
> ODataEntity productUpdates = client.getObjectFactory().newEntity(
>     new FullQualifiedName("ODataDemo", "Product"));
> URI categoryRef = client.newURIBuilder(serviceRoot)
>     .appendEntitySetSegment("Categories")
>     .appendKeySegment(2)
>     .build();
> ODataLink category = client.getObjectFactory()
>     .newEntityNavigationLink("Categories", categoryRef);
> productUpdates.getNavigationLinks().add(category);
> ODataEntityUpdateRequest<ODataEntity> req = client
>     .getCUDRequestFactory().getEntityUpdateRequest(productUri,
>                       UpdateType.PATCH, productUpdates);
> ODataEntityUpdateResponse<ODataEntity> res = req.execute();
> I have the following error. The target service expects an array and a string is sent. See request and response below.
> Here is the simplified content of the request:
> PATCH /V4/OData/(S(li4s4wcplcgyiy3uvuog1lxl))/OData.svc/Products(1)
> {
>   "@odata.type":"#ODataDemo.Product",
>   "Categories@odata.bind":"http://localhost:8080/V4/OData/(S(li4s4wcplcgyiy3uvuog1lxl))/OData.svc/Categories(2)"
> }
> and the simplified content of the response:
> HTTP/1.1 400 Bad Request
> {"error":{"code":"","message":"An error occurred while processing this request.","innererror":{"message":"The resource set reference navigation property 'Categories' has a property annotation 'odata.bind' with a string value. Resource set reference navigation properties can only have a property annotation 'odata.bind' with an array value.","type":"Microsoft.OData.Core.ODataException","stacktrace":"   at "}}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)