cancel
Showing results for 
Search instead for 
Did you mean: 

System expected the element '{http://www.w3.org/2005/Atom}entry'

sreehari_vpillai
Active Contributor
0 Kudos

Hi Experts,

I am trying to update t=data through SAP NW gateway using the /IWBEP/IF_MGW_APPL_SRV_RUNTIME~UPDATE_ENTITY method.

I am using REST Client in firefox browser to test the update service.

Steps Followed .

1.     used GET method to get the x-csrf-token (and that was successfull)

2.     Using the obtained x-csrf-token, i am updating the data (PUT)

3.     Updated the body XML with some data .

Here  i m getting the return error - System expected the element '{http://www.w3.org/2005/Atom}entry'

How ever the request which i made is reaching G/W .

Please help me on this. I am really stuck. Whether to change something in gateway side, or in the XML side.

Thanks in Advance..

Accepted Solutions (1)

Accepted Solutions (1)

sreehari_vpillai
Active Contributor
0 Kudos

Hi Now its working perfectly.

Problem was with the XML body.

Instead of the previous one, i used thew below.

<?xml version="1.0" encoding="utf-8"?><entry xml:base="**:8000/sap/opu/odata/sap/ZMAKT_DESC_SRV/" xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><id>http://**:8000/sap/opu/odata/sap/ZMAKT_DESC_SRV/Makt(Spras='E',Matnr='1')</id><title type="text">Makt(Spras='E',Matnr='1')</title><updated>2013-10-24T03:42:55Z</updated><category term="ZMAKT_DESC_SRV.Makt" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="Makt(Spras='E',Matnr='1')" rel="edit" title="Makt"/><content type="application/xml"><m:properties><d:Maktg>Double dukker</d:Maktg><d:Maktx>Asset Procurement</d:Maktx><d:Spras>E</d:Spras><d:Matnr>1</d:Matnr></m:properties></content></entry>

Answers (6)

Answers (6)

mattisebastian
Participant
0 Kudos

Hi,

I just encountered this problem and it was cause by "bad whitespaces" in the payload which I found with an XML schema validator:

https://jsonformatter.org/xml-formatter

I was able to fix it by removing the "bad whitespaces" and replacing them with a space character.

Bonus tip: afterwards the API expects the

header "Content-Type" with value "application/atom+xml;type=entry".

Hope this helps someone.

Best regards
Matti

0 Kudos

Hello Experts,

I am facing the same issue when I am trying to POST some data from REST Client.

My plan is to make it work in REST Client first, then consume it in SAPUI5 Application.

Kindly help me with the same.

Thanks & Regards:

Azhar

Former Member
0 Kudos

Hi pFA this one

"1.0" encoding="utf-8"?>

<entry xml:base=
"**:8000/sap/opu/odata/sap/ZODATA_PROJ_157_SRV/"

xmlns=
"http://www.w3.org/2005/Atom"

xmlns:m=
"http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"

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

<id>http://**:8000/sap/opu/odata/sap/ZODATA_PROJ_157_SRV/Material_set</id>

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

<updated>2013-10-24T03:42:55Z</updated>

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

<link href=
"Material_set" rel="edit" title="material"/>

<content type=
"application/xml">

<m:properties>

<d:Matnr>FANTA</d:Matnr>

<d:Matkl>03</d:Matkl>

<d:Mbrsh>1</d:Mbrsh>

<d:Mtart>A004</d:Mtart>

<d:Meins>EA</d:Meins>

</m:properties>

</content>

</entry>

This xml working for me when i got a erorr using post method to create a data into database table.

Thanks

Arun Kumar Varshney

kammaje_cis
Active Contributor
0 Kudos

As Ron pointed the problem is with your request body. May be you can post it here.

How did you compose your request body xml?

In my blog on Gateway Client, I have written on how to compose the request body for Update Request as well.

http://scn.sap.com/docs/DOC-47626

Thanks

Krishna

Former Member
0 Kudos

You will get this error when the XML in the body is not right. Use the XML validator in GW Web Client to validate it.

former_member201354
Participant
0 Kudos

Hi  Everyone,

Even me too facing the same issue .

Thanks in Advance.