Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Unsupported Media Type

$
0
0

Hi all,

 

 

I've created a OData service formulated by the following metadata:

 

<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">

  <edmx:DataServices m:DataServiceVersion="2.0" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

  <Schema Namespace="HanaODataTests.bookstore" xmlns="http://schemas.microsoft.com/ado/2008/09/edm" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

  <EntityType Name="booksType">

  <Key>

  <PropertyRef Name="title"/>

  </Key>

  <Property MaxLength="100" Name="title" Nullable="false" Type="Edm.String"/>

  <Property MaxLength="100" Name="ISBN" Type="Edm.String"/>

  <Property Name="editions" Type="Edm.Int32"/>

  <Property MaxLength="100" Name="author.name" Type="Edm.String"/>

  <Property Name="author.birth" Type="Edm.DateTime"/>

  <NavigationProperty FromRole="booksDependent" Name="Author" Relationship="HanaODataTests.bookstore.WroteType" ToRole="writersPrincipal"/>

  </EntityType>

  <EntityType Name="writersType">

  <Key>

  <PropertyRef Name="name"/>

  <PropertyRef Name="birth"/>

  </Key>

  <Property MaxLength="100" Name="name" Nullable="false" Type="Edm.String"/>

  <Property Name="birth" Nullable="false" Type="Edm.DateTime"/>

  <Property MaxLength="100" Name="title.title" Type="Edm.String"/>

  <NavigationProperty FromRole="writersPrincipal" Name="Titles" Relationship="HanaODataTests.bookstore.WroteType" ToRole="booksDependent"/>

  </EntityType>

  <Association Name="WroteType">

  <End Multiplicity="1" Role="writersPrincipal" Type="HanaODataTests.bookstore.writersType"/>

  <End Multiplicity="*" Role="booksDependent" Type="HanaODataTests.bookstore.booksType"/>

  <ReferentialConstraint>

  <Principal Role="writersPrincipal">

  <PropertyRef Name="name"/>

  </Principal>

  <Dependent Role="booksDependent">

  <PropertyRef Name="title"/>

  </Dependent>

  </ReferentialConstraint>

  </Association>

  <EntityContainer Name="bookstore" m:IsDefaultEntityContainer="true">

  <EntitySet EntityType="HanaODataTests.bookstore.booksType" Name="books"/>

  <EntitySet EntityType="HanaODataTests.bookstore.writersType" Name="writers"/>

  <AssociationSet Association="HanaODataTests.bookstore.WroteType" Name="Wrote">

  <End EntitySet="writers" Role="writersPrincipal"/>

  <End EntitySet="books" Role="booksDependent"/>

  </AssociationSet>

  </EntityContainer>

  </Schema>

  </edmx:DataServices>

</edmx:Edmx>

 

and to insert books and writers through a POST request is working but now I'm trying create a link between two entities. For that, I wrote the following request:

 

POST /HanaODataTests/bookstore.xsodata/writers(name='Test',birth=datetime'2014-07-11T00:00:00.0000000')/$links/Titles HTTP/1.1

Host: xxxxxxxxxx

DataServiceVersion: 1.0

MaxDataServiceVersion: 2.0

Content-Type: application/xml

 

<uri xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices">

 

http://xxxxxxx/HanaODataTests/bookstore.xsodata/books('HAPI%20Hana%20Integration%20Test%20Volume%201')

 

</uri>

 

and I always get as a response:

 

<?xml version="1.0" encoding="utf-8" standalone="yes"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code/><message xml:lang="en-US">Unsupported character set: The entity of the request is in a format not supported by the requested resource for the requested method.</message></error>

 

Or sometimes the response is that the statement cannot be a POST statement because Titles are not an entity.

Anyone have any idea what I'm doing wrong?

 

Thank you for your attention

Pablo


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>