0

i'm working with SapUi5 to build a webapp which connects to our Netweaver Gateway. This App consumes the data successfully, i only have problems to create objects with the service.

The response data i get is

500 Internal Server Error content-type application/xml - - 001560AA0E081DEB8CA398CC1690D406 Error while parsing an XML stream - 52FB96CF506729E0E1000000C0A8EA2A

The Gateway error log says

Exception /IWCOR/CX_BAD_REQUEST occured.

When i insert data with the Gateway Client everything works fine.

EDIT

My Object is created like this

var testObject = {
            smtp_adr: "ui5@test.de",
            first_name: "SapUI5",
            last_name: "test",
            nr: 9999
    };

and i upload it with

oModel.create("/MyService", testObject, null, false, null,function() {
        alert("Create successful");
});
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Fussel
  • 123
  • 1
  • 1
  • 9
  • 1
    This exception happens on the gateway side. Could you please post the code you use from sapui5 to trigger the create object and provide the actual HTTP request with headers that it triggers to gateway (use chrome dev tools to sniff this request) – dparnas Feb 13 '14 at 19:38

3 Answers3

2

500 internal server error is related to payload. You are not passing the data properly to back-end. Please check the data that you are passing from front-end.

Ash
  • 119
  • 3
  • 5
  • 11
1

The problem is stated in your error message "bad request" ... oModel.create allows 3 parameters (Source)

  1. sPath e.g. /MyService
  2. oData e.g. testObject
  3. mParameters?

You are passing 4 parameters, which leads to a "BAD_REQUEST" ...

Please see this, where its explained how to pass data: SAPUI5 oModel.create() - how to post data to the SAP backend?

Community
  • 1
  • 1
dotchuZ
  • 2,621
  • 11
  • 39
  • 65
0

Do you have access to the gateway box through SAP GUI can you check the error logs there?

The error your are getting around parsing XML stream most often happens when there is either an additional field in your create model or there is a type mismatch. can you try passing in

var testObject = { smtp_adr: "ui5@test.de", first_name: "SapUI5", last_name: "test", nr: "9999" };

And see if that makes a difference most of the times I have seen this the type mismatch has been the issue.

saoirse
  • 53
  • 5