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

Michael Bolz resolved OLINGO-844.
---------------------------------
    Resolution: Fixed

> While Inserting New Entity Getting BAD REQUEST as response from ODATA Service
> -----------------------------------------------------------------------------
>
>                 Key: OLINGO-844
>                 URL: https://issues.apache.org/jira/browse/OLINGO-844
>             Project: Olingo
>          Issue Type: Bug
>          Components: odata2-core
>    Affects Versions: V2 2.0.0, V2 2.0.5
>         Environment: Windows 10 Operating System
>            Reporter: Sushil
>            Assignee: Christian Amend
>            Priority: Blocker
>              Labels: newbie
>
> Hi All,
> I am Using 2.0.0 client version to call ODATA Service. When we invoke 
> respective API to insert record we are getting Error 400 - BAD REQUEST.
>  1) Its Secured ODATA Service : we made sure that authorization header is 
> added to request.
> 2) We added properties of Entity using Map <String, Obejct> and we can see 
> that those are properly set in JSON object while pushing the data.
> 3) URL is correctly formed : First we tested the URL with SOAPUI with test 
> JSON object, Entity is properly get saved and we got Http Response as 201 - 
> Created.
> 4) While Calling the same ODATA Service API by using Olingo 
> contentType = Application/Json
> entitySet = SomeEntityName
> data = map<String,Object > with properties of SomeEntity
> properties = EntityProviderWriteProperties.serviceRoot(rootUri).build();
> ODataResponse response = EntityProvider.writeEntry(contentType, entitySet, 
> data, properties);
> After getting the response we retrieved the entity from response as follows :
> Object entity = response.getEntity();
>     if (entity instanceof InputStream) {
>       byte[] buffer = streamToArray((InputStream) entity);
>       // just for logging
>       String content = new String(buffer);
>       print(httpMethod + " request on uri '" + absolutUri + "' with 
> content:\n  " + content + "\n");
> when we print the absolutUri : its correct as that of SOAPUI we tested.
> Content = JSON object that we are posting is not formed correctly as that 
> SOAP UI when we print the JSON object its look like as follows :
> Here Entity Name is "SomeEntity"
>  {
>       "d": {
>               "__metadata": {
>                       "id": "SomeEntitySomeEntity('SomeEntityUser')",
>                       "uri": "SomeEntitySomeEntity('SomeEntityUser')",
>                       "type": "SFOData.SomeEntity"
>               },
>               "addressLine1": null,
>               "addressLine2": null,
>               "addressLine3": null,
>               "userId": "SomeEntityUser",
>               "username": "SomeEntityUser",
>               "zipCode": null,
>       }
>  }
> as we can see that this object is not formed correctly We are suspecting we 
> as result we are getting 400 BAD REQUEST response from ODATA Service. 
> formation of JSON object is taking care by olingo Library.
> Please guide us on this issue.
> Thanks !



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to