User Profile
Surbhibabbar
Copper Contributor
Joined Feb 26, 2020
User Widgets
Recent Discussions
Connection reset while connecting with sharepoint online from java graph API
when trying to connect to sharepoint using graph api, via HttpsUrlConnection as below: TrustManager[] dummyTrustManager = new TrustManager[] { new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; SSLContext sc = SSLContext.getInstance("TLSv1.2"); sc.init(null, dummyTrustManager, new java.security.SecureRandom()); String token = helper.getToken(); //get oauth2 token URL url = new URL(newUrl); //input url HttpsURLConnection urlConnection = (HttpsURLConnection) url.openConnection(); urlConnection.setSSLSocketFactory(sc.getSocketFactory()); urlConnection.setRequestMethod("GET"); urlConnection.setRequestProperty("Authorization", "Bearer " + token); urlConnection.setRequestProperty("Content-Type", "application/" + "json"); urlConnection.connect(); it works in windows, but fails in linux machine with below error: java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:196) at java.net.SocketInputStream.read(SocketInputStream.java:122) at sun.security.ssl.InputRecord.readFully(InputRecord.java:442) at sun.security.ssl.InputRecord.read(InputRecord.java:480) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:927) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323) .. java version in linux is : root@workflow-test-new:/home/tomcat7/apache-tomcat-7/logs# java -version java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)2.1KViews0likes0CommentsAccess welcome page of a sharepoint online site and get its html
I have a site hosted on the sharepoint online, which has a particular webpage at the address: https://<domain-name>/abc/Pages/Home.aspx which can be access through web browser and can see its html using view source, Home.aspx is the default redirect pge set by admin. so when we query till abc, we get redirected to Home.aspx automatically. But when I try to access this page using the rest WS call in post man, like this https://graph.microsoft.com/v1.0/sites/<domain-name>/sites/<site-id> It does not redirect. I need to connect to https://<domain-name>/abc/Pages/Home.aspx using rest api call through my code and access html of the web page. Please guide me here.1.2KViews0likes0Comments
Recent Blog Articles
No content to show