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>