Legacy Dev Forum Posts

 View Only

Sign Up

Via proxy to call API access to login.mypurecloud from Windows server by a batch

  • 1.  Via proxy to call API access to login.mypurecloud from Windows server by a batch

    Posted 06-05-2025 19:23

    leotree | 2022-09-29 16:08:52 UTC | #1

    Hi, one customer wants to create batch to do API CALL, the target that access to login.mypurecloud.jp to get data. However batch will be ran on a windows server, and let the traffic go through Proxy. Setup the server IP bypass the Proxy Anthentication, so it should no necessary clientId and clientSecret.

    //Simple source code import java.net.InetSocketAddress; import java.net.Proxy; import com.mypurecloud.sdk.v2.ApiClient; import com.mypurecloud.sdk.v2.ApiException; import com.mypurecloud.sdk.v2.ApiResponse; import com.mypurecloud.sdk.v2.PureCloudRegionHosts; import com.mypurecloud.sdk.v2.extensions.AuthResponse;

    PureCloudRegionHosts region = PureCloudRegionHosts.apnortheast1; Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(XXX.XXX.XXX.XXX, 8080)); ApiClient.Builder.standard().withBasePath(region).withAuthenticatedProxy(proxy,clientId, clientSecret).build(); ApiResponse<AuthResponse> authResponse = apiClient.authorizeClientCredentials(clientId, clientSecret); String token = authResponse.getBody().getAccess_token(); System.out.println(token); //

    But, get the below return. where am I wrong?

    // [main] INFO org.apache.http.impl.execchain.RetryExec - I/O exception (java.net.SocketException) caught when processing request to {tls}->http://XXX.XXX.XXX.XXX:8080->https://login.mypurecloud.jp:443: Connection reset [main] INFO org.apache.http.impl.execchain.RetryExec - Retrying request to {tls}-


    leotree | 2022-09-29 16:11:08 UTC | #2

    [main] INFO org.apache.http.impl.execchain.RetryExec - I/O exception (java.net.SocketException) caught when processing request to {tls}->http://XXX.XXX.XXX.XXX:8080->https://login.mypurecloud.jp:443: Connection reset [main] INFO org.apache.http.impl.execchain.RetryExec - Retrying request to {tls}->http://XXX.XXX.XXX.XXX:8080->https://login.mypurecloud.jp:443 Exception in thread "main" java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:221) at java.net.SocketInputStream.read(SocketInputStream.java:152) at com.ibm.jsse2.b.a(b.java:262) at com.ibm.jsse2.b.a(b.java:33) at com.ibm.jsse2.av.a(av.java:579) at com.ibm.jsse2.av.i(av.java:574) at com.ibm.jsse2.av.a(av.java:280) at com.ibm.jsse2.av.startHandshake(av.java:431) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:394) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.upgrade(DefaultHttpClientConnectionOperator.java:192) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.upgrade(PoolingHttpClientConnectionManager.java:369) at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:415) at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107) at com.mypurecloud.sdk.v2.connector.apache.ApacheHttpClientConnector.invoke(ApacheHttpClientConnector.java:71) at com.mypurecloud.sdk.v2.ApiClient.getAPIResponse(ApiClient.java:750) at com.mypurecloud.sdk.v2.ApiClient.authorizeClientCredentials(ApiClient.java:302) at csc.batch.main.reportdata.report.GenesysTokenInfoProxy.main(GenesysTokenInfoProxy.java:34)


    tim.smith | 2022-09-29 16:28:35 UTC | #3

    This looks like your proxy isn't able to successfully create a connection either between the client and the proxy or the proxy and the login server. I would recommend engaging the administrator of your proxy to troubleshoot it. Logging on your proxy server should yield more information for your investigation.


    system | 2022-10-30 16:28:57 UTC | #4

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 16516