[
https://issues.apache.org/jira/browse/OLINGO-512?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Thierry Templier closed OLINGO-512.
-----------------------------------
Resolution: Not a Problem
Using the method appendEntitySetSegment of URIBuilder fixes the problem.
> 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",
>
> "[email protected]":"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)