cancel
Showing results for 
Search instead for 
Did you mean: 

PHP to OData Payload issue - Error while parsing an XML stream

05-11-2023 10:21 PM
nikhilshinde1234 Discoverer
800 views 4 comments
0 Likes
SAP Managed Tags
Subscribe

Hello All,

I am trying to submit a JSON data to SAP which is resulting an Error : Error while parsing an XML stream.

Current payload submitting to the SAP

{

"Aufnr": "000001000703",

"werks": "1200",

"gamng": "106160.000",

"gmein": "KG",

"type": " ",

"message": " "

}

Resulting format in SAP getting :

"{\"Aufnr\":\"000001000703\",\"werks\":\"1200\",\"gamng\":\"106160.000\",\"gmein\":\"KG\",\"type\":\" \",\"message\":\" \"}"

what I am suppose to get in SAP from PHP

what I am getting in SAP from PHP

0 Likes

Accepted Solutions (0)

Answers (2)

Answers (2)

nikhilshinde1234
Discoverer
0 Likes

Thanks !..

I got the issue. It is due to I have encoded the JSON data twice.
I corrected my code and issue resolved.

Your answer was a quick help to understand the issue.

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Likes

I converted your comment to an answer so you can accept it ;-).

You can upvote my answer as being helpful as well ;-).

Andre_Fischer
Product and Topic Expert
Product and Topic Expert
0 Likes

Maybe you forgot to tell SAP Gateway which format your request is based on and which format of response is accepted by your client as described in this

Blog post