Skip to Content
0
Nov 26, 2018 at 02:03 PM

Batch in ODATA for PUT returns 'Error while parsing an XML stream' - 'CX_SXML_PARSE_ERROR' - SAPUI5

1512 Views

Hi Guys,

I'm trying to send a table from my frontend to backend via ODATA call. I'm using batch processing and the code is as below.

var sPath = "emp_tabSet(Objid='121')";
changeOperations.push(oModel.createBatchOperation(sPath,"PUT",dataT[0],null));
oModel.addBatchChangeOperations(changeOperations);
oModel.submitBatch(function(oData, oResponse, aErrorResponses){
if(aErrorResponses.length>0){
sap.m.MessageBox.alert("Error in Creating. Please try again...");
console.log(aErrorResponses);
}else{
sap.m.MessageBox.alert("Batch Successfull", {});
}
});

I have also redefined the methods /IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_BEGIN and /IWBEP/IF_MGW_CORE_SRV_RUNTIME~CHANGESET_END in the backend.

I tried executing a GET request from my gateway system and it worked fine. When I tried to execute a PUT, which is actually what I need, just see a popup that says empty response received. In the browser I have 'Error while parsing an XML stream' after all the batch submissions. I tried researching the SCN forums and found that it maybe an issue with the payload but I couldn't figure out what. Here's my payload that I got from chrome.

--batch_6763-24d6-b1aa Content-Type: multipart/mixed; boundary=changeset_ee32-82a7-97f4

--changeset_ee32-82a7-97f4 Content-Type: application/http Content-Transfer-Encoding: binary

PUT emp_tabSet(Objid='121') HTTP/1.1 Accept-Language: EN Accept: application/atom+xml,application/atomsvc+xml,application/xml MaxDataServiceVersion: 2.0 DataServiceVersion: 2.0 Content-Type: application/atom+xml Content-Length: 1648

<a:entry xmlns:a="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"><a:author><a:name/></a:author><a:id>http:/sap/opu/odata/sap/ZHS_VALIDARE_SRV/emp_tabSet(ObjKey='000000',Objid='55007881',Req='')</a:id><a:category term="ZHS_VALIDARE_SRV.emp_tab" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><a:content type="application/xml"><m:properties><d:ObjKey m:type="Edm.String">000000</d:ObjKey><d:Objid m:type="Edm.String">55007881</d:Objid><d:Stext m:type="Edm.String">Dl VASILE TOMARIU</d:Stext><d:TmvEePos m:type="Edm.String">Sef uel etansare a</d:TmvEePos><d:TmvEeOrgun m:type="Edm.String">RENAULT GROUP</d:TmvEeOrgun><d:TmvEeWerks m:type="Edm.String">Uzina Vehicule Dacia</d:TmvEeWerks><d:TmvEeBtrtl m:type="Edm.String">Plate-forme ind</d:TmvEeBtrtl><d:ObjSel m:type="Edm.String">X</d:ObjSel><d:Status m:type="Edm.String"/><d:Mtvhs m:type="Edm.String">0002</d:Mtvhs><d:Versl m:type="Edm.String">3</d:Versl><d:MtvhsText m:type="Edm.String">Fabricatie Piese schimb si CKD</d:MtvhsText><d:BeginTime m:type="Edm.String">18:00</d:BeginTime><d:EndTime m:type="Edm.String">19:00</d:EndTime><d:Stdaz m:type="Edm.String">1.00</d:Stdaz><d:StdazCumul m:type="Edm.String">0.00</d:StdazCumul><d:TmvEePersk m:type="Edm.String"/><d:Ipn m:type="Edm.String"/><d:Req m:type="Edm.String"/><d:Acord m:type="Edm.String"/><d:AfisareVersl m:type="Edm.String"/><d:DataAcord m:type="Edm.String" m:null="true"/><d:OraAcord m:type="Edm.String">PT00H00M00S</d:OraAcord></m:properties></a:content></a:entry> --changeset_ee32-82a7-97f4--

--batch_6763-24d6-b1aa--

Can someone please point me in the right direction? Your help is highly valued and appreciated.

Thanks in advance