on 07-29-2015 2:38 PM
Hi All,
Does anyone tried already to access SAP PI ESR and ID via JAVA Programming. (URL connectivity + Basic authentication).
kindly share the idea to do so.
I am currently trying with HTTPURLConnection with Basic authentication , however i end up with below error.
java.lang.IllegalStateException: Already connected
PFB the code below.
URL u = new URL(urlString);
HttpURLConnection hURLConnection = (HttpURLConnection) u.openConnection();
hURLConnection.setRequestMethod("GET");
int responseCode=hURLConnection.getResponseCode();
hURLConnection.setRequestProperty("Authorization","Basic"+authStringdetails);
System.out.println("url Response Code" +hURLConnection.getResponseCode());
Best Regards,
Suresh S
Hi Suresh,
seems code is incomplete for me.
few code lines like
hURLConnection.setRequestProperty .....? for authentication
also if you used GET the we need to call setDoInput(true);
Regards, Prasanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prasanth,
Yeah!! I have already included the setDoInput to true . However it ended with same error.
Do you have idea on this part?
Exception in thread "main" java.lang.IllegalStateException: Already connected
at sun.net.www.protocol.http.HttpURLConnection.setRequestProperty(HttpURLConnection.java:2410)
Best Regards,
Suresh S
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.