Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

oData xml parsing error while sending data to server

Hi, I am getting this error:

The following problem occurred: HTTP request failed400,Bad Request,{"error {"code":"CX_SXML_PARSE_ERROR/001560AA0E081DEB8CA398CC1690D406"


Sap NetWeaver Gateway error log just says "Error while parsing an XML string"

writing a web application in WEBIDE using javascript. Tried to send data like this:

OData.request({

       requestUri: "http://asd/sap/opu/odata/sap/ZHREC_EMPL_CR_SRV/EmployeeSet",

       method: "GET",

       headers: {

            "X-Requested-With": "XMLHttpRequest",

            "Content-Type": "application/atom + xml",

            "DataServiceVersion": "2.0",

            "X-CSRF-Token": "Fetch"

       }

  },

  function(data, response) {

       var header_xcsrf_token = response.headers['x-csrf-token'];

       var oHeaders = {

            "x-csrf-token": header_xcsrf_token,

            'Accept': 'application/json'

       };

       OData.request({

            requestUri: "http://asd/sap/opu/odata/sap/ZHREC_EMPL_CR_SRV/EmployeeSet",

            method: "POST",

            headers: oHeaders,

            data: oEntry

       },

       function(data, request) {

            console.log("Success");

       },

       function(err) {

            console.log("Forward failed: " + err);

       }

  );

  },

  function(err) {

       var request = err.request;

       var response = err.response;

       console.log("Error in Get -- Request " + request + " Response " + response);

  }

  );

oEntry has mostly Edm.String values with 1 Edm.DateTime value but that is not the problem.

I have also tried like this:

var sServiceUrl = "http://asd/sap/opu/odata/sap/ZHREC_EMPL_CR_SRV";

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

        oModel.create('/EmployeeSet', oEntry, null,

            function() {

                alert("success");

            },

            function() {

                alert("failure");

            }

        );

I still get same error. What is causing the error and how can i get over it (beer doesn't count)?

Thanks in advance,

Tags:
Former Member
Former Member replied

Apparently one parameter was a number but webservice was expecting a string so i added oEntry.ParameterName.toString() and worked.

Sorry for bothering:)

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question