Skip to Content
avatar image
Former Member

SAP Gateway wrong Payload

Hi iam facing some problemes with my OData SAP Gateway Service.

Iam trying to make a deep insert. for my answer request i use the result of my get that looks like this:

/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/FatherSet(1)?$expand=LevelOne/LevelTwo

<?xml version="1.0" encoding="UTF-8"?>


-<entry xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xml:base="XXXXX/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns="http://www.w3.org/2005/Atom">


<id>http://XXXXX/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/FatherSet(1)</id>


<title type="text">FatherSet(1)</title>


<updated>2017-10-05T07:40:05Z</updated>


<category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" term="ZLEVEL_FAMILY_SRV_01.Father"/>


<link title="Father" href="FatherSet(1)" rel="self"/>




-<link title="LevelOne" type="application/atom+xml;type=feed" href="FatherSet(1)/LevelOne" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/LevelOne">




-<m:inline>




-<feed xml:base="http://XXXXX/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/"><br>

<id>http://XXXXX/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/FatherSet(1)/LevelOne</id><br>

<title type="text">SonSet</title>


<updated>2017-10-05T07:40:05Z</updated>




-<author>


<name/>


</author>


<link title="SonSet" href="FatherSet(1)/LevelOne" rel="self"/>




-<entry>


<id>http://xxxx/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/SonSet(1)</id>


<title type="text">SonSet(1)</title>


<updated>2017-10-05T07:40:05Z</updated>


<category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" term="ZLEVEL_FAMILY_SRV_01.Son"/>


<link title="Son" href="SonSet(1)" rel="self"/>


<link title="Level2" type="application/atom+xml;type=entry" href="SonSet(1)/Level2" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Level2"/>




-<link title="LevelTwo" type="application/atom+xml;type=feed" href="SonSet(1)/LevelTwo" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/LevelTwo">




-<m:inline>




-<feed xml:base="http://xxxxx/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/">


<id>http://xxxxx/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/SonSet(1)/LevelTwo</id>


<title type="text">GrandsonSet</title>


<updated>2017-10-05T07:40:05Z</updated>




-<author>


<name/>


</author>


<link title="GrandsonSet" href="SonSet(1)/LevelTwo" rel="self"/>




-<entry>


<id>http://xxxxx/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/GrandsonSet(2)</id>


<title type="text">GrandsonSet(2)</title>


<updated>2017-10-05T07:40:05Z</updated>


<category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" term="ZLEVEL_FAMILY_SRV_01.Grandson"/>


<link title="Grandson" href="GrandsonSet(2)" rel="self"/>


<link title="Level3" type="application/atom+xml;type=entry" href="GrandsonSet(2)/Level3" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Level3"/>


<link title="GToSon" type="application/atom+xml;type=feed" href="GrandsonSet(2)/GToSon" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/GToSon"/>




-<content type="application/xml">




-<m:properties>


<d:Id>2</d:Id>


<d:Nr>1</d:Nr>


<d:Name>PAM</d:Name>


<d:Age>20</d:Age>


<d:Lvl>3</d:Lvl>


</m:properties>


</content>


</entry>




-<entry>


<id>http://xxxxxx/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/GrandsonSet(1)</id>


<title type="text">GrandsonSet(1)</title>


<updated>2017-10-05T07:40:05Z</updated>


<category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" term="ZLEVEL_FAMILY_SRV_01.Grandson"/>


<link title="Grandson" href="GrandsonSet(1)" rel="self"/>


<link title="Level3" type="application/atom+xml;type=entry" href="GrandsonSet(1)/Level3" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Level3"/>


<link title="GToSon" type="application/atom+xml;type=feed" href="GrandsonSet(1)/GToSon" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/GToSon"/>




-<content type="application/xml">




-<m:properties>


<d:Id>1</d:Id>


<d:Nr>1</d:Nr>


<d:Name>DANIEL</d:Name>


<d:Age>20</d:Age>


<d:Lvl>3</d:Lvl>


</m:properties>


</content>


</entry>


</feed>


</m:inline>


</link>


<link title="SonToG" type="application/atom+xml;type=feed" href="SonSet(1)/SonToG" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/SonToG"/>




-<content type="application/xml">




-<m:properties>


<d:Id>1</d:Id>


<d:Nr>1</d:Nr>


<d:Name>ANDRE</d:Name>


<d:Age>40</d:Age>


<d:Lvl>2</d:Lvl>


<d:Sons>2</d:Sons>


</m:properties>


</content>


</entry>




-<entry>


<id>http://xxxxx/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/SonSet(2)</id>


<title type="text">SonSet(2)</title>


<updated>2017-10-05T07:40:05Z</updated>


<category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" term="ZLEVEL_FAMILY_SRV_01.Son"/>


<link title="Son" href="SonSet(2)" rel="self"/>


<link title="Level2" type="application/atom+xml;type=entry" href="SonSet(2)/Level2" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Level2"/>




-<link title="LevelTwo" type="application/atom+xml;type=feed" href="SonSet(2)/LevelTwo" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/LevelTwo">




-<m:inline>




-<feed xml:base="http://xxxx/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/">


<id>http://xxxxx/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/SonSet(2)/LevelTwo</id>


<title type="text">GrandsonSet</title>


<updated>2017-10-05T07:40:05Z</updated>




-<author>


<name/>


</author>


<link title="GrandsonSet" href="SonSet(2)/LevelTwo" rel="self"/>




-<entry>


<id>http://xxxxxx/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/GrandsonSet(4)</id>


<title type="text">GrandsonSet(4)</title>


<updated>2017-10-05T07:40:05Z</updated>


<category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" term="ZLEVEL_FAMILY_SRV_01.Grandson"/>


<link title="Grandson" href="GrandsonSet(4)" rel="self"/>


<link title="Level3" type="application/atom+xml;type=entry" href="GrandsonSet(4)/Level3" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Level3"/>


<link title="GToSon" type="application/atom+xml;type=feed" href="GrandsonSet(4)/GToSon" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/GToSon"/>




-<content type="application/xml">




-<m:properties>


<d:Id>4</d:Id>


<d:Nr>2</d:Nr>


<d:Name>TIM</d:Name>


<d:Age>23</d:Age>


<d:Lvl>3</d:Lvl>


</m:properties>


</content>


</entry>




-<entry>


<id>http://xxxxx/sap/opu/odata/SAP/ZLEVEL_FAMILY_SRV_01/GrandsonSet(3)</id>


<title type="text">GrandsonSet(3)</title>


<updated>2017-10-05T07:40:05Z</updated>


<category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" term="ZLEVEL_FAMILY_SRV_01.Grandson"/>


<link title="Grandson" href="GrandsonSet(3)" rel="self"/>


<link title="Level3" type="application/atom+xml;type=entry" href="GrandsonSet(3)/Level3" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Level3"/>


<link title="GToSon" type="application/atom+xml;type=feed" href="GrandsonSet(3)/GToSon" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/GToSon"/>




-<content type="application/xml">




-<m:properties>


<d:Id>3</d:Id>


<d:Nr>2</d:Nr>


<d:Name>CHRIS</d:Name>


<d:Age>22</d:Age>


<d:Lvl>3</d:Lvl>


</m:properties>


</content>


</entry>


</feed>


</m:inline>


</link>


<link title="SonToG" type="application/atom+xml;type=feed" href="SonSet(2)/SonToG" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/SonToG"/>




-<content type="application/xml">




-<m:properties>


<d:Id>2</d:Id>


<d:Nr>1</d:Nr>


<d:Name>JERRY</d:Name>


<d:Age>42</d:Age>


<d:Lvl>2</d:Lvl>


<d:Sons>2</d:Sons>


</m:properties>


</content>


</entry>


</feed>


</m:inline>


</link>




-<content type="application/xml">




-<m:properties>


<d:Id>1</d:Id>


<d:Nr>1</d:Nr>


<d:Name>FLORIAN</d:Name>


<d:Age>60</d:Age>


<d:Lvl>1</d:Lvl>


<d:Sons>1</d:Sons>


</m:properties>


</content>


</entry>

to me that result looks great. One entity for level 1 2 for level 2 and each of them has 2 level 3.

i have an association from Father ID to Son Nr and Son ID to Grandson Nr

Both are 1 to n

but when i use this result as post request the raw data in

io_data_provider->read_entry_data

is completly wrong. the first level 2 entity has no level 3 and the second level 2 has both first level 3 entities.

-

EDIT:

Why is it working if i use json as request but not with xml ?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Oct 05, 2017 at 01:23 PM

    Hey quick update from me:

    why does this work if i use json request and not with xml ?

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Peter,

      From your response it seems that, JSON payload is working fine where as the XML is having some flaw.

      JSON (Javascript object notation) has become a popular alternative to XML for various reasons. ... Less verbose- XML uses more words than necessary. JSON is faster- Parsing XML software is slow and cumbersome.

      -PG

  • Dec 15, 2017 at 06:00 PM

    Hello Peter,

    I am facing a similar issue .

    When I use XML format the result of Expand query is weird (dont know if i am missing something in my url )

    Add comment
    10|10000 characters needed characters exceeded