cancel
Showing results for 
Search instead for 
Did you mean: 

[SAP BTP] CORS error when making a POST call

apucci
Discoverer

Hello everyone!

Im using the trial of SAP BTP for testing the functionality of this environment. I decided to try something: A custom HTML report and CAP service.

So, while testing, I noticed that the calls to the service didn't work. So, digging up, people said that I should use the API Management for that part of the project.

So I did. And with the first step of this tutorial, could get the GET calls working. But the POST calls still not working.

The project is saved in this repository. (Please ignore the app folder, alongside the index.html. It was a fast page that I didn't give too much attention, and is still in WIP stage. If you want to test it, just write the calls in the console)

This call gave me a "502 bad Gateway" error.

This call gave me a "400 bad request" error.

Using a ajax call still gave me the '400 bad request' error.

Did I miss something to config in API Management or in the service? Do I have to try something else?

Thank you in advance

Accepted Solutions (0)

Answers (2)

Answers (2)

vishalakshmi
Contributor
0 Kudos

Hello Agustin,

you can open the link by using S user access.

Please find the note information below:

3156901 - 502: Bad Gateway. Invalid Server certificate when connecting with Cloud Connector to an on-premise SAP system.

Symptom

  1. Failed message in Cloud Integration

com.sap.it.rt.adapter.http.api.exception.HttpResponseException: An internal server error occured: HTTP response '502: Bad Gateway. Invalid server certificate' when communicating with <url>

2. In the Cloud connector trace the error message is

Caused by: com.sap.core.connectivity.spi.ssl.SSLHandshakeException: Invalid server certificate

Caused by: java.lang.IllegalArgumentException: Peer host '<hostname>' does not match certificate DNS names [hostname]

Environment

  • Connector Framework
  • Cloud Integration
  • SAP Integration Suite
  • SAP Cloud Connector 2.13.2 or higher

Cause

The ERP system server certificate DNS name is different from the Cloud Connector HTTPS connection internal hostname.

Resolution

Modify the Cloud connector internal host name to match the certificate DNS Name of the ERP system.

See Also

  • 2837010 - SSL endpoint does not match server certificate DNS names
  • 2452568 - Log and Trace files for SAP Cloud Connector
  • 3095201 - On Premise access fails with error message "Invalid server certificate"

Thanks,

Lakshmi.

apucci
Discoverer
0 Kudos
Hello Lakshmi,As I said in the comment before, im not using Cloud Connector or a ERP system. Im using the CAP service defined for making call through API Management, that is saved in the HANA cloud database. When im making this POST calls from the console browser, it looks like this in the debugger of the API Management. (Using the one that gaves me a 502 Bad gateway error)

Its possible to make POST calls to this CAP service? Its there any guide for this?

Thank you for the quick response.

Agustin

vishalakshmi
Contributor
0 Kudos

Hello Agustin,

Modify the Cloud connector internal host name to match the certificate DNS Name of the ERP system.

Please check the below link:

https://me.sap.com/notes/3156901/E

Thanks,

Lakshmi.

apucci
Discoverer
0 Kudos

Hello Lakshmi,

Im not using Cloud Connector, or a ERP system. The POST call is to the CAP service that's defined in the same repository. (A full stack cloud project).

Also, for some reason, I cant access to the URL that you just gave me. Its said "Error in HTTP request" and "undefined".

Thanks you for the quick response.

Agustin.