Quantcast
Channel: SCN : Popular Discussions - SAP NetWeaver Gateway Developer Center
Viewing all articles
Browse latest Browse all 1657

com.sap.nw.gateway.odata.client.exceptions.RestClientException

$
0
0

Exception in thread "main" com.sap.nw.gateway.odata.client.exceptions.RestClientException at com.sap.nw.gateway.odata.client.connectivity.impl.RestClientBase.execute(RestClientBase.java:54) at com.rico.Main.main(Main.java:75)

What is the reason for the above error message?  Below is the respective snippit of code:  Note that it fails on the IRestResponse response = restClient.execute(request);  line.

 

IServerConnectionParameters gateway = new ServerConnectionParameters(DEMO_HOST, PORT,CLIENT_ID, true); IAuthentication credentials = new UsernamePasswordCredentials(USERNAME,PASSWORD); KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); InputStream stream = new FileInputStream(pathToCAcerts); trustStore.load(stream,null); KeyStore keystore = SSLUtil.loadKeyStore(new FileInputStream(pathToJKS), "changeit"); javax.net.ssl.SSLContext sslContext = null; sslContext = SSLUtil.createSSLContext(keystore, "changeit", trustStore); SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory(); X509Authentication x509Authentication = new X509Authentication(sslSocketFactory); IRestClient restClient = RestClientFactory.createInstance(gateway, x509Authentication, Representation.ATOM); IRestRequest request = new RestRequest(URI);                                 IRestResponse response = restClient.execute(request);                               ODataCollection collecion= ODataParserFactory.createInstance(Representation.ATOM).parseODataCollection(response.getBody()); ODataEntry[] entries = collecion.getEntries();


Viewing all articles
Browse latest Browse all 1657

Trending Articles