[
https://issues.apache.org/jira/browse/OLINGO-510?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14278418#comment-14278418
]
Thierry Templier commented on OLINGO-510:
-----------------------------------------
Hi Christian,
I got the code using a git pull from olingo git repository.
I saw that the signature of the method getReferenceAddingRequest changed. There
are now three parameters (serviceRoot, targetURI, reference) instead of two
before. I can't figure out how to use it... Could you give me some details
about this?
Here is the code I used previously to use the feature:
String serviceRoot =
"http://services.odata.org/V4/OData/(S(li4s4wcplcgyiy3uvuog1lxl))/OData.svc";
URI productCategoriesUri = client.newURIBuilder(serviceRoot)
.appendEntitySetSegment("Products").appendKeySegment(1)
.appendNavigationSegment("Categories").appendRefSegment()
.build();
URI ref = client.newURIBuilder(serviceRoot)
.appendEntitySetSegment("Categories").appendKeySegment(1)
.build();
ODataReferenceAddingRequest req = client.getCUDRequestFactory()
.getReferenceAddingRequest(productCategoriesUri, ref);
ODataReferenceAddingResponse res = req.execute();
Thanks!
Thierry
> Problem when using the ODataReferenceAddingRequest to add a reference to a
> property
> -----------------------------------------------------------------------------------
>
> Key: OLINGO-510
> URL: https://issues.apache.org/jira/browse/OLINGO-510
> 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
> Assignee: Christian Amend
>
> When using a ODataReferenceAddingRequest to a reference for a property:
> String serviceRoot = (...);
> URI productCategoriesUri = client.newURIBuilder(serviceRoot)
> .appendEntitySetSegment("Products")
> .appendKeySegment(1)
> .appendNavigationSegment("Categories")
> .appendRefSegment()
> .build();
> URI ref = client.newURIBuilder(serviceRoot)
> .appendEntitySetSegment("Categories")
> .appendKeySegment(1)
> .build();
> ODataReferenceAddingRequest req = client.getCUDRequestFactory()
> .getReferenceAddingRequest(productCategoriesUri, ref);
> ODataReferenceAddingResponse res = req.execute();
> The link of the reference to add isn't sent in the payload of the request.
> Here is the simplified content of the request:
> POST
> /V4/OData/(S(li4s4wcplcgyiy3uvuog1lxl))/OData.svc/Products(1)/Supplier/$ref
> 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":"An unexpected 'EndOfInput' node was found when reading from
> the JSON reader. A 'StartObject'
> node was
> expected.","type":"Microsoft.OData.Core.ODataException","stacktrace":" "
> }
> }
> }
> We should have something like this in the payload:
> {
> "@odata.id":"http://(...)/Suppliers(4)"
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)