Magento xmlrpc session expires immediately

First; this question is similar to another but still unresolved question: the call to magento soap api expires immediately

I am working on a client-server module based on XMLRPC. The Magento server has several API methods that work with the Java client. I am using standard Java XMLRPC Jars in my client.

I have a "login" call that retrieves a session. Then I pass this on to make different calls. I checked that this returns (something similar) a valid session.

Object result1 = client.execute("login", ob1); session = (String) result1; 

The following call that I make using this session fails:

 org.apache.xmlrpc.XmlRpcException: Session expired. Try to relogin. 

What I checked:

  • Set Magento Session Timeout to High
    • This does not work.
  • Check server time setting
    • this is.
  • Active Validation API User in Magento
    • Yes.
  • Check api_session table for hash session
    • See below.

api_session table

  • I do not have a current session hash.
  • It also has only 11 entries; I registered about 50 times.
  • Session time differs significantly from select CURRENT_TIME
    • Update: it doesn't matter (MySQL is written in GMT)

Here is what I see:

 mysql> select * from api_session limit 50; +---------+---------------------+----------------------------------+ | user_id | logdate | sessid | +---------+---------------------+----------------------------------+ | 5 | 2013-02-01 16:01:49 | 9099b50 | 5 | 2013-02-01 16:02:10 | 7312c1a | 5 | 2013-02-01 16:05:43 | a6ce30c +---------+---------------------+----------------------------------+ 11 rows in set (0.00 sec) mysql> select CURRENT_TIME; +--------------+ | CURRENT_TIME | +--------------+ | 14:58:03 | +--------------+ 
+4
source share
1 answer

ummm .... Perhaps this is due to my own safety.

In the above errors, my login method has taken the advice from this article: Irreversibly destroying data in Java

As in this article, I passed the char array to the input method. This ultimately led to empty credentials passed to the login method.

Flow to those who may be unfamiliar

  • The login method that is called is in Mage/Api/Model/Server/Handler/Abstract.php
  • This calls the login method in Mage/Api/Model/Session.php
  • I dumped the input into the log, they came up empty.

I have returned to using my usual, unsafe method of passing strings directly to the method. It worked!

EDIT: Of course, this has the disadvantage that I returned to using strings instead of char [] arrays. Will the answer be updated if I figure out how to do this.

+1
source

All Articles