olingo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pablo Leira <ple...@denodo.com>
Subject Bug updating with olingo
Date Wed, 15 Jun 2016 12:15:55 GMT
Hi,
I am trying to develop a client with olingo allowing operations of update.
I have not problemas with the updates in this service
http://services.odata.org/V4/OData/(S(15tob54caeixspyecq150krq))/OData.svc/.
But when I deploy my own service using the example of
https://olingo.apache.org/doc/odata4/maven.html
When I make a update over this service, it returns a status code 204 but
the service is not updated.

The code that I am using is:

 String serviceRoot = "http://192.168.0.90:8080/DemoService/DemoService.svc
";
        final ODataClient client =  ODataClientFactory.getClient();
        URI productsUri = client.newURIBuilder(serviceRoot)
                            .appendEntitySetSegment("Products(1)")
                            .build();


        final ClientCollectionValue<ClientValue> collectionValue =
getCollectionValue(client);

        ClientEntity newEntity =  client.getObjectFactory().newEntity(new
FullQualifiedName( "OData.Demo", "Product"));

//
 newEntity.getProperties().add(client.getObjectFactory().newCollectionProperty("Emails",
//                collectionValue));

newEntity.getProperties().add(client.getObjectFactory().newPrimitiveProperty("Name",
client.getObjectFactory().newPrimitiveValueBuilder().buildString("Notebook
Basic 15 updated")));
        ODataEntityUpdateRequest<ClientEntity> req = client
                .getCUDRequestFactory().getEntityUpdateRequest(productsUri,
                        UpdateType.PATCH,newEntity );

        System.out.println("URI: " + req.getURI());
        req.setAccept("application/json;odata.metadata=minimal");
        ODataEntityUpdateResponse<ClientEntity> res = req.execute();
        if (res.getStatusCode()==204) {
            System.out.println("Updated entity");
        } else {
            System.out.println("Error updating entity");
        }


I undestand that the changes should be made effective or I should get a
exception.

Thanks in advance
Pablo

Mime
View raw message