cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot find reference com.sap.core.connectivity.api.http.HttpDestination

pieterjanssens
Active Participant
0 Kudos

Using Eclipse Oxygen with

Servlet code

...
import com.sap.core.connectivity.api.http.HttpDestination;
...
Context ctx = new InitialContext();
HttpDestination destination = (HttpDestination) ctx.lookup("java:comp/env/myDestination");
HttpClient client = destination.createHttpClient();

web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"; version="3.1">
  <display-name>myApp</display-name>
  <resource-ref>
    <res-ref-name>myDestination</res-ref-name>
    <res-type>com.sap.core.connectivity.api.http.HttpDestination</res-type>
</resource-ref>
</web-app>

Accepted Solutions (1)

Accepted Solutions (1)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Pieter,

The SDK you are using (Web Tomcat 😎 will implement the Connectivity Configuration API.

Therefore, please adjust your code according to the documentation instead of using the HTTDestination API.

Best regards,
Ivan

pieterjanssens
Active Participant
0 Kudos

Hi Ivan.

I will check it out thanks. Would I then get all necessary HTTP properties from the destination through the API (host, authentication, ...) and use an HTTPClient such as Apache's?

I did that at first as a test with a hard coded URL. This worked fine when testing locally in Eclipse with the Tomcat server. But once I ran it on SCP I saw this "java.net.ConnectException: Connection timed out (Connection timed out) (local port 53603 to address 0.0.0.0, remote port 443 to address xxx.xxx.xxx.xxx

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Pieter,

Yes, using the API should work. Hard-coding the URL should work as well.

The reason the connection has timed-out is probably due to the lack of setting up SSL and the related keystore for all certificates involved in the handshake. Check the documentation provided - it clearly states how you can retrieve the keystore to use in a URLConnection class (it is the last sample code).

Best regards,
Ivan

Answers (0)