cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 oDataModel v2 net::ERR_EMPTY_RESPONSE

former_member594564
Participant
0 Kudos

Hello to all!

I get net::ERR_EMPTY_RESPONSE when I try to create new entry in oData (with sap.ui.model.odata.v2.ODataModel) from SAPUI5.

I have .xsodata service, that exposed on XS Classic and SAPUI5`s frontend. SAP HANA Trace looks like nothing is happening (there are no records about inserting a new record).

When I`m try to POST new entry to oData with Postman, this works well. GET-request works well with SAPUI5.

Unfortunately, v2.ODataModel`s error callback is not very informative:

  1. headers: []
  2. message: "HTTP request failed"
  3. responseText: ""
  4. statusCode: 0
  5. statusText: ""
  6. __proto__: Object

Any help is appreciated! Thanks!

Best regards,

Pavel Mazharov.

former_member594564
Participant
0 Kudos

UPDATE:

When I turn off batch mode in manifest.json for this model - it works well. But I need a batch ... How can I solve this problem?

It worked few weeks ago with batch, but I can`t find in SAPUI5 release notes something about batch in v2.oDataModel. Maybe something wrong in last releases?

...<br>"models": {
	"": {
		"type": "sap.ui.model.odata.v2.ODataModel",
		"dataSource": "mainService",
		"preload": true,
		"settings": {
			"useBatch": false,
			"disableHeadRequestForToken": true,
			"defaultOperationMode": "Server",
			"defaultBindingMode": "TwoWay",
			"defaultCountMode": "None",
			"defaultUpdateMethod": "Put"
		}
	},<br>...

UPD:

I changed SAPUI5 version with UI5 Diagnostics (to https://sapui5.hana.ondemand.com/1.69.0/resources/sap-ui-core.js), but error still exists.

UPD:

Checked CORS in /sap/hana/xs/admin/: GET, HEAD, POST, OPTIONS, PUT, DELETE are enabled

Accepted Solutions (1)

Accepted Solutions (1)

former_member594564
Participant
0 Kudos

Hello everybody!

The problem was solved. This was a problem in the corporate network settings. I really don't know the real reason for this behavior, but when we added the SCP address to the firewall exceptions, everything worked fine.

P.S.: the $ batch request from the Postman works well when the request from the browser fails.

Answers (2)

Answers (2)

junwu
Active Contributor
0 Kudos

did you debug your call at server side? can you call your service from postman?

former_member594564
Participant
0 Kudos

Hi, Jun!

Thanks for your reply. I looked in SAP HANA Trace and did not find anything about the request from SAPUI5 (but I have logs if I make a request to the xsodata service from the Postman).

As I said, Postman works well with POST requests, unfortunately, I do not know how to generate a $batch request from Postman.

Best regards,

Pavel Mazharov

mvaibhav
Contributor
0 Kudos

hi Pavel,

Please check the following thread:

https://answers.sap.com/questions/12888844/odata-batch-request-from-webide-fails.html

Thanks,

Vaibhav

former_member594564
Participant
0 Kudos

Hi Vaibhav!

Thank you for you reply, but "prevent_xsrf" has been disabled in .xsaccess file. I tried to change this field to true, but I have another error:

403, message: "HTTP request failed", responseText: "Request execution failed due to missing or invalid XSRF token"

The most surprising is that there was no problem before, it appeared unexpectedly, the configuration was not changed anywhere.

Best regards,

Pavel Mazharov.