cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing OnPremise OData Service from HCP Java Application

0 Kudos

Hello SAP Community

I have a JAVA application that is deployed on SCP and with that app I want to access an OData Service from an internal OnPremise system. In order to achieve that I went through the following tutorial/guide of SAP:

https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/474eae1b69c9434b9dce0314b8d...

Initially, I deployed the JAVA application on SCP and then I installed the Cloud Connector locally (localhost) and successfully connected/mapped the Cloud connector with my SCP (trial) account:

In tab Access Control I added the URL path "/" and selected the acces policy "Path and all sub-paths". With that I gave the access to all paths.

After that I configured the destination in SCP under "Destinations":

The inserted URL is the same as virtual host name in cloud connector. The Location-ID is also sync with the Location-ID in Cloud Connector.

For testing purposes I also implemented an UI5 application from template and successfully linked my OnPremise system with the UI5 application via destination. The next thing I did, I deployed the UI5 application on SCP and registered the UI5-app to an sample Fiori Launchpad. Until here everything was fine and worked well - the data from the OnPremise system is displayed in my UI5 application.

But now, if I run my Java Application on SCP I get the following error-response:

Unable to tunnel through proxy. Proxy returns "HTTP/1.1 405 Method Not Allowed"

There are no error logs in the cloud connector which suggests that my JAVA application does not even get to the Cloud connector. My JAVA code is exactly same as in the above mentioned guide/tutorial. Did anyone of you already face this or similiar problem and knows a solution or has a hint?

Accepted Solutions (0)

Answers (1)

Answers (1)

oppancs
Contributor

Dear Blazenko,

This refers to that the servlet tries to communicate directly via the SCP's proxy to the outisde internet (instead of connecting to the Cloud Connector). That is why this error is not described in ljs_trace, however it can be found in localhost_http_access<date>.log. The messge "HTTP/1.1 405 Method Not Allowed" itself means that http method is not GET or POST requests.

I am not sure why this call is transfered to the proxy.

I deem the problem should be investigated in the servlet code. It happens in e.g. a scenario when you have your own SSLContext and SSLSocketFactory in the servlet, however this mechanism is being done automatically by the destination. Actually if you try to do it manually you will encrypt the data twice. This can explain the error. The proxy receives some "encrypted garbage" instead of the expected "GET /sap/opu/odata/<...>". So instead of seeing a familiar method like "GET" or "POST", the proxy sees some "garbage" (=encrypted data) and responds with "Method not allowed".

Also I found an answered thread with similar problem and the logic is related to my description (double encription) also: https://archive.sap.com/discussions/thread/3932895

Probably you have different error scenario, but you may gather some hints form it. I hope it helps somehow.

Best Regards,
Barnabás Paksi

0 Kudos

Hello Barnabás

Thank you for your reply. But what irritates me is the fact that I took 1:1 the example of SAP from this link:

https://help.sap.com/viewer/cca91383641e40ffbe03bdc78f00f681/Cloud/en-US/474eae1b69c9434b9dce0314b8d...

The only thing I changed is the JAVA class name and also the destination name. Everything else is as described in the tutorial/sample. That should work, right? If not, do you have another sample or code snippet? It's hard to find another solution that matches my requirements..

Best regards,

Blazenko Babic