Reputation: 123
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: "[email protected]",
first_name: "SapUI5",
last_name: "test",
nr: 9999
};
and i upload it with
oModel.create("/MyService", testObject, null, false, null,function() {
alert("Create successful");
});
Upvotes: 0
Views: 10716
Reputation: 2651
The problem is stated in your error message "bad request" ... oModel.create allows 3 parameters (Source)
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?
Upvotes: 1
Reputation: 53
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: "[email protected]", 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.
Upvotes: 0
Reputation: 119
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.
Upvotes: 2