cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI ESR and ID access via Standalone JAVA application

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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