cancel
Showing results for 
Search instead for 
Did you mean: 

407 Authentication Required : Autherize.net java integration

Hi ,

 

1) I have created sandbox account ( i have loginID, transactionKey )

2) I created customer profile by passing an xml input to API URL https://apitest.authorize.net/xml/v1/request.api ( Not from Sample code in GITHUB but from POSTMAN )

3) I am using sample code to call getCustomerProfile ( code URL : https://github.com/AuthorizeNet/sample-code-java/blob/master/src/main/java/net/authorize/sample/Cust... )

4) I added System.setProperty("https.proxyUse", "true"), System.setProperty("https.proxyHost", "***.**.***.***"), System.setProperty("https.proxyPort", "8080") before ApiOperationBase.setEnvironment(Environment.SANDBOX);

5) I am getting null responce from API

6) I debugged it to ApiOperationBase.class line 145 , and the message is 407 , Authentication Required .

 

I have hit a roadblock and i am unable to figureout a solution , please suggest .

 

is proxy wrong : NO

I tried creating httpURL connection to API url with proxy and i am getting responce as below , but i need to figure out why the sample code provided is not working

Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("***.**.***.***", 8080));
        
            java.net.URL url = new java.net.URL("https://apitest.authorize.net/xml/v1/request.api");
            java.net.HttpURLConnection conn = (java.net.HttpURLConnection)url.openConnection(proxy);
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
            conn.setAllowUserInteraction(false);
            // POST the data
            java.io.OutputStreamWriter sw = new java.io.OutputStreamWriter(conn.getOutputStream(), "UTF8");
            sw.write(xml);

 

 

 

 

vijayR
Member
1 REPLY 1

Hi 

 

Thank you for bringing this our attention, can you share more details on the version of  the JAVA-SDK you are using ?

 

And does your proxy requires authentication ?

 

Regards

Kaushik

 

 

kikmak42
Authorize.Net Expert Authorize.Net Expert
Authorize.Net Expert