Senthamizh Chelvi Kaliyaperumal created OLINGO-816:
------------------------------------------------------
Summary: EntityProvider.readEntry throws "Illegal argument" in
JSON Deep Insert in a custom JDBC implementation
Key: OLINGO-816
URL: https://issues.apache.org/jira/browse/OLINGO-816
Project: Olingo
Issue Type: Bug
Components: odata2-core
Affects Versions: V2 2.0.5
Reporter: Senthamizh Chelvi Kaliyaperumal
Fix For: V2 2.0.6
We are facing problem while trying to implement JSON deep insert, using custom
back end logic for POST operation.
The EdmProvider is defined properly with all the necessary entities along with
associations, navigations etc. When we are trying to read ODataEntry from
EntityProvider, we are getting an error message saying "Illegal argument for
method call with message 'Address'."
ODataEntry entry = EntityProvider.readEntry(requestContentType,
uriInfo.getStartEntitySet(), content, properties); This line fails and throws
the error.
1) Metadata:
<?xml version='1.0' encoding='UTF-8'?>
<edmx:Edmx Version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices m:DataServiceVersion="1.0"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<Schema Namespace="org.apache.olingo.odata2.ODataCars"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityType Name="Car">
<Key>
<PropertyRef Name="Id"/>
</Key>
<Property Name="Id" Type="Edm.Int32" Nullable="false"/>
<Property Name="Model" Type="Edm.String" Nullable="false"
DefaultValue="Hugo" MaxLength="100" m:FC_TargetPath="SyndicationTitle"/>
<Property Name="ManufacturerId" Type="Edm.Int32"/>
<Property Name="Price" Type="Edm.Decimal"/>
<Property Name="Currency" Type="Edm.String" MaxLength="3"/>
<Property Name="ModelYear" Type="Edm.String" MaxLength="4"/>
<Property Name="Updated" Type="Edm.DateTime" Nullable="false"
ConcurrencyMode="Fixed" m:FC_TargetPath="SyndicationUpdated"/>
<Property Name="ImagePath" Type="Edm.String"/>
<NavigationProperty Name="Manufacturer"
Relationship="org.apache.olingo.odata2.ODataCars.Car_Manufacturer_Manufacturer_Cars"
FromRole="Car_Manufacturer" ToRole="Manufacturer_Cars"/>
</EntityType>
<EntityType Name="Manufacturer">
<Key>
<PropertyRef Name="Id"/>
</Key>
<Property Name="Id" Type="Edm.Int32" Nullable="false"/>
<Property Name="Name" Type="Edm.String" Nullable="false"
MaxLength="100" m:FC_TargetPath="SyndicationTitle"/>
<Property Name="Updated" Type="Edm.DateTime" Nullable="false"
ConcurrencyMode="Fixed" m:FC_TargetPath="SyndicationUpdated"/>
<NavigationProperty Name="Cars"
Relationship="org.apache.olingo.odata2.ODataCars.Car_Manufacturer_Manufacturer_Cars"
FromRole="Manufacturer_Cars" ToRole="Car_Manufacturer"/>
</EntityType>
<ComplexType Name="Address">
<Property Name="Street" Type="Edm.String"/>
<Property Name="City" Type="Edm.String"/>
<Property Name="ZipCode" Type="Edm.String"/>
<Property Name="Country" Type="Edm.String"/>
</ComplexType>
<Association Name="Car_Manufacturer_Manufacturer_Cars">
<End Type="org.apache.olingo.odata2.ODataCars.Car" Multiplicity="*"
Role="Car_Manufacturer"/>
<End Type="org.apache.olingo.odata2.ODataCars.Manufacturer"
Multiplicity="1" Role="Manufacturer_Cars"/>
</Association>
<EntityContainer Name="ODataCarsEntityContainer"
m:IsDefaultEntityContainer="true">
<EntitySet Name="Cars"
EntityType="org.apache.olingo.odata2.ODataCars.Car"/>
<EntitySet Name="Manufacturers"
EntityType="org.apache.olingo.odata2.ODataCars.Manufacturer"/>
<AssociationSet Name="Cars_Manufacturers"
Association="org.apache.olingo.odata2.ODataCars.Car_Manufacturer_Manufacturer_Cars">
<End EntitySet="Manufacturers" Role="Manufacturer_Cars"/>
<End EntitySet="Cars" Role="Car_Manufacturer"/>
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
2) Sample Request Payload used in POST:
{
"Id": 1,
"Name": "Star Powered Racing",
"Address": {
"Street": "Star Street 137",
"City": "Stuttgart",
"ZipCode": "70173",
"Country": "Germany"
},
"Cars" : [
{
"Id": 1,
"Model": "F1 W03",
"ManufacturerId": 1,
"Price": "189189.43",
"Currency": "EUR",
"ModelYear": "2012",
"Updated": "/Date(1355224271271)/",
"ImagePath": "file://imagePath/w03"
}
]
}
3) Error Message:
url: http://localhost:8080/my-car-service/CarService.svc/Manufacturers, POST
{
"error": {
"code": "Error Code: 400",
"message": {
"lang": "en",
"value": "Illegal argument for method call with message 'Address'."
}
}
}
Could you please help?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)