olingo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramesh Reddy (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (OLINGO-1040) Insert /Update operation fails with 400 bad request
Date Thu, 13 Apr 2017 16:55:41 GMT

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

Ramesh Reddy resolved OLINGO-1040.
----------------------------------
    Resolution: Information Provided
      Assignee: Ramesh Reddy

https://github.com/apache/olingo-odata4/blob/master/fit/src/test/java/org/apache/olingo/fit/base/EntityCreateTestITCase.java



> Insert /Update operation fails with 400 bad request
> ---------------------------------------------------
>
>                 Key: OLINGO-1040
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1040
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata4-client
>    Affects Versions: (Java) V4 4.3.0
>            Reporter: Archana
>            Assignee: Ramesh Reddy
>
> Hi ,
> I am using Olingo 4.3.0 client core api and trying to do CUD operations.
> I am able to do select /delete operations but my insert and update code fails throwing
400 bad request.
> I was able to see my POST request and header but not sure if the body is sent correctly.Here's
code snippet I used:
> URI insertUri = coreclient.newURIBuilder(serviceRoot)
> 				.appendEntitySetSegment("contacts").build();
> ClientEntity contact = coreclient.getObjectFactory().newEntity(
> 				new FullQualifiedName("Microsoft.Dynamics.CRM.contact"));
> contact.getProperties().add(
> 				coreclient.getObjectFactory().newPrimitiveProperty(
> 						"firstname",
> 						coreclient.getObjectFactory()
> 								.newPrimitiveValueBuilder()
> 								.buildString("InsertTest")));
> contact.getProperties().add(
> 				coreclient.getObjectFactory().newPrimitiveProperty(
> 						"lastname",
> 						coreclient.getObjectFactory()
> 								.newPrimitiveValueBuilder()
> 								.buildString("InsertTestlastname")));
> ODataEntityCreateRequest<ClientEntity> req = coreclient			.getCUDRequestFactory().getEntityCreateRequest(insertUri,contact);
> System.out.println(req.execute().getStatusCode());
> I get below exception :
> Exception in thread "main" org.apache.olingo.client.api.communication.ODataClientErrorException:
entity [HTTP/1.1 400 Bad Request]
> 	at org.apache.olingo.client.core.communication.header.ODataErrorResponseChecker.checkResponse(ODataErrorResponseChecker.java:75)
> 	at org.apache.olingo.client.core.communication.request.AbstractRequest.checkResponse(AbstractRequest.java:54)
> 	at org.apache.olingo.client.core.communication.request.AbstractODataRequest.doExecute(AbstractODataRequest.java:310)
> 	at org.apache.olingo.client.core.communication.request.cud.ODataEntityCreateRequestImpl.execute(ODataEntityCreateRequestImpl.java:88)
> 	at org.apache.olingo.client.core.communication.request.cud.ODataEntityCreateRequestImpl.execute(ODataEntityCreateRequestImpl.java:47)
> Can anyone please assist?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message