cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error while parsing an XML stream

Former Member
0 Likes
32,508

Hi,

I'm receiving an "error whilse parsing an XML stream" while calling the oModel.create() - method.

Can you help me with that?

Here is my Code:

//Creating a new Entry

var oModel = sap.ui.getCore().getModel("Service");

var oRequestBody =

        {

            Kunnr: parseInt(iIdSelectedDebitor),

            Matnr: sActualMatnr.toString(),

            DatumHinzu: new Date(),

            Gekauft: false,

            DatumGekauft: null

        };

oModel.create("/WListSet", oRequestBody, null,

               function(oSuccess, oResponse)

               {...},

               function(oError)

               {...});


//ServiceBinding.js

    var sUrl = "/sap/opu/odata/sap/ZSHOPPING_APP_SRV/";

    var oModel = new sap.ui.model.odata.ODataModel(sUrl, true);

    sap.ui.getCore().setModel(oModel, "Service");

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

All the elements in the requestBody have to be parsed as in the service definition.

Like this:

var oRequestBody =
   {
   Kunnr: iIdSelectedDebitor.toString(),
   Matnr: sActualMatnr.toString(),
   DatumHinzu: new Date(),
   Gekauft: "",
   DatumGekauft: new Date()
   };
   

Answers (1)

Answers (1)

karthikarjun
Active Contributor

Hi Julia,

Could you please post your "network tab error message" ( with screenshots).

1. Check your payload data. Some times it could be different from GW payload.

Goto segw transaction---> Run your service ---> add payload ---->F8 ( if works)

Check the same data from SAPUI5.

I think here you used new date for DatumHinzu field. It might be a problem


Thanks,

KA

Former Member
0 Likes

Everything looks fine in the Gateway-Client.

Here are the Screenshots: