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 09:55:13 UTC

[jira] [Updated] (OLINGO-510) Problem when using the ODataReferenceAddingRequest to add a reference to a property

     [ https://issues.apache.org/jira/browse/OLINGO-510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thierry Templier updated OLINGO-510:
------------------------------------
    Description: 
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)"
}

  was:
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 405 Method Not Allowed
{
  "error":{
    "code":"",
    "message":"The URI (...) is not valid for POST operation. For POST operations, the URI must refer to a service operation or an entity set."
  }
}

We should have something like this in the payload:

{
  "@odata.id":"http://(...)/Suppliers(4)"
}


> 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
>
> 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)