Hello I'm integrating anet-java-sdk-1.4.6 with my Android application because the anet-java-sdk-android-2.0.5 doesn't provide some cim classes and other functionalities that I currently use in java. So after integrating my code with android, I get error like:
07-24 11:18:42.157: E/HttpClient(1845): HttpClient execution failed 07-24 11:18:42.157: E/HttpClient(1845): java.lang.NullPointerException 07-24 11:18:42.157: E/HttpClient(1845): at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:86) 07-24 11:18:42.157: E/HttpClient(1845): at java.lang.StringBuffer.<init>(StringBuffer.java:83) 07-24 11:18:42.157: E/HttpClient(1845): at org.apache.harmony.xml.dom.CharacterDataImpl.setData(CharacterDataImpl.java:88) 07-24 11:18:42.157: E/HttpClient(1845): at org.apache.harmony.xml.dom.CharacterDataImpl.<init>(CharacterDataImpl.java:39) 07-24 11:18:42.157: E/HttpClient(1845): at org.apache.harmony.xml.dom.TextImpl.<init>(TextImpl.java:36) 07-24 11:18:42.157: E/HttpClient(1845): at org.apache.harmony.xml.dom.DocumentImpl.createTextNode(DocumentImpl.java:360) 07-24 11:18:42.157: E/HttpClient(1845): at org.apache.harmony.xml.dom.DocumentImpl.createTextNode(DocumentImpl.java:48) 07-24 11:18:42.157: E/HttpClient(1845): at net.authorize.cim.Transaction.addPaymentTransaction(Transaction.java:601) 07-24 11:18:42.157: E/HttpClient(1845): at net.authorize.cim.Transaction.createCustomerProfileTransaction(Transaction.java:950) 07-24 11:18:42.157: E/HttpClient(1845): at net.authorize.cim.Transaction.toXMLString(Transaction.java:719) 07-24 11:18:42.157: E/HttpClient(1845): at net.authorize.util.HttpClient.createHttpPost(HttpClient.java:69) 07-24 11:18:42.157: E/HttpClient(1845): at net.authorize.util.HttpClient.executeXML(HttpClient.java:200) 07-24 11:18:42.157: E/HttpClient(1845): at net.authorize.Merchant.postTransaction(Merchant.java:295) 07-24 11:18:42.157: E/HttpClient(1845): at com.indies.storage.helper.Customer.doPayment(Customer.java:217) 07-24 11:18:42.157: E/HttpClient(1845): at com.indies.storage.PaymentActivity$1.doInBackground(PaymentActivity.java:67) 07-24 11:18:42.157: E/HttpClient(1845): at com.indies.storage.PaymentActivity$1.doInBackground(PaymentActivity.java:1) 07-24 11:18:42.157: E/HttpClient(1845): at android.os.AsyncTask$2.call(AsyncTask.java:287) 07-24 11:18:42.157: E/HttpClient(1845): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 07-24 11:18:42.157: E/HttpClient(1845): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 07-24 11:18:42.157: E/HttpClient(1845): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 07-24 11:18:42.157: E/HttpClient(1845): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 07-24 11:18:42.157: E/HttpClient(1845): at java.lang.Thread.run(Thread.java:856) 07-24 11:18:42.216: E/AndroidRuntime(1845): FATAL EXCEPTION: AsyncTask #3 07-24 11:18:42.216: E/AndroidRuntime(1845): java.lang.RuntimeException: An error occured while executing doInBackground() 07-24 11:18:42.216: E/AndroidRuntime(1845): at android.os.AsyncTask$3.done(AsyncTask.java:299) 07-24 11:18:42.216: E/AndroidRuntime(1845): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 07-24 11:18:42.216: E/AndroidRuntime(1845): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 07-24 11:18:42.216: E/AndroidRuntime(1845): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 07-24 11:18:42.216: E/AndroidRuntime(1845): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 07-24 11:18:42.216: E/AndroidRuntime(1845): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 07-24 11:18:42.216: E/AndroidRuntime(1845): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 07-24 11:18:42.216: E/AndroidRuntime(1845): at java.lang.Thread.run(Thread.java:856) 07-24 11:18:42.216: E/AndroidRuntime(1845): Caused by: java.lang.NullPointerException 07-24 11:18:42.216: E/AndroidRuntime(1845): at net.authorize.cim.Result.importRefId(Result.java:105) 07-24 11:18:42.216: E/AndroidRuntime(1845): at net.authorize.cim.Result.createResult(Result.java:46) 07-24 11:18:42.216: E/AndroidRuntime(1845): at net.authorize.Merchant.postTransaction(Merchant.java:296) 07-24 11:18:42.216: E/AndroidRuntime(1845): at com.indies.storage.helper.Customer.doPayment(Customer.java:217) 07-24 11:18:42.216: E/AndroidRuntime(1845): at com.indies.storage.PaymentActivity$1.doInBackground(PaymentActivity.java:67) 07-24 11:18:42.216: E/AndroidRuntime(1845): at com.indies.storage.PaymentActivity$1.doInBackground(PaymentActivity.java:1) 07-24 11:18:42.216: E/AndroidRuntime(1845): at android.os.AsyncTask$2.call(AsyncTask.java:287) 07-24 11:18:42.216: E/AndroidRuntime(1845): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 07-24 11:18:42.216: E/AndroidRuntime(1845): ... 4 more
Please help solving this issue..
Thanks in advance.
07-24-2013 04:21 AM
Thats an NPE and has nothing to do with Authorize.net, post the block of code that you used. Showing us the logcat won't help unless there is a block of code with it.
07-24-2013 05:41 AM
Ok, I first I didn't get the what causes error so posted the logcat output.. The code I'm using creates userProfile and userpaymentprofile successfully but gives above error when trying to do payment transaction.. Here's the code snippet I'm using for payment transaction.. This is my doPayment method..
net.authorize.cim.Transaction transaction = merchant.createCIMTransaction(net.authorize.cim.TransactionType.CREATE_CUSTOMER_PROFILE_TRANSACTION); transaction.setCustomerProfileId(customerProfileId); transaction.setCustomerPaymentProfileId(customerPaymentProfileId); transaction.setValidationMode(ValidationModeType.TEST_MODE); PaymentTransaction paymentTransaction=PaymentTransaction.createPaymentTransaction(); Order order=Order.createOrder(); order.setTotalAmount(new BigDecimal(amount)); paymentTransaction.setOrder(order); paymentTransaction.setTransactionType(TransactionType.AUTH_CAPTURE); transaction.setPaymentTransaction(paymentTransaction); net.authorize.cim.Result<net.authorize.cim.Transaction> result=(net.authorize.cim.Result<net.authorize.cim.Transaction>) merchant.postTransaction(transaction); if(result.isOk()) { DirectResponse response=result.getDirectResponseList().get(0); System.out.print("response"+response.getDirectResponseMap().get(ResponseField.TRANSACTION_ID)); } else { System.out.print("Order Fail"+ result.getMessages().get(0)); }
I'm getting error at merchant.postTransaction as shown from logcat..
Thanks..
07-24-2013 09:45 PM