Problem partially solved!
This class works!
public class Auth {
protected final static String RMI_URL =
"rmi://localhost:1099/RMIDispatcher"; // change to match the remote server
protected RemoteDispatcher rd = null;
public Auth() {
try {
rd = (RemoteDispatcher) Naming.lookup(RMI_URL);
} catch (NotBoundException e) {
e.printStackTrace();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
}
//public Map<String, Object> userLogin(String username, String password)
public void userLogin(String username, String password)
throws RemoteException, GenericServiceException {
String resultKeys;
Map res;
res = rd.runSync("userLogin", UtilMisc.toMap("login.username", username,
"login.password", password));
System.out.println("---: Service Result RES | class
name:"+res.getClass().getName());
if (res.containsKey("userLogin")){
Object o = res.get("userLogin");
System.out.println("---: Service Result RES | o get class
name:"+o.getClass().getName());
GenericValue gv = (GenericValue) res.get("userLogin");
System.out.println("---: Service Result RES | gv get class name
:"+gv.getClass().getName());
Map rmap = gv.getAllFields();
// TEST: System.out.println("---: Service Result RES
RMAP:"+rmap.get("userLogin"));
if (res.keySet().isEmpty()) {
System.out.println("---: Service Result RES: IS EMPTY!!!");
} else {
resultKeys = rmap.keySet().toString();
System.out.println("---: Service Result RES | RMAP
Keys:"+resultKeys);
for ( Object m : rmap.keySet()){
System.out.println("---: Service Result RES | RMAP - KEY:
"+m.toString());
System.out.println("---: VALUE:
"+rmap.get(m.toString()));
}
}
}
}
}
The method just gets all possible fields out of the userLogin RMI call. I
guess.
It has all the dependencies of the ExampleRemoteClient.java set (see
comments within that file).
[The dependencies might be a bit less, but I did not want really to check at
the moment ;)]
If you read the output of this class call to userLogin, it has nothing to do
with the userLogin service!!!
as exposed in:
https://demo-trunk.ofbiz.apache.org/webtools/control/ServiceList?sel_service_name=userLogin
The output is:
---: Service Result RES | class name:javolution.util.FastMap
---: Service Result RES | o get class name:org.ofbiz.entity.GenericValue
---: Service Result RES | gv get class name :org.ofbiz.entity.GenericValue
---: Service Result RES | RMAP Keys:[successiveFailedLogins, enabled,
lastUpdatedStamp, lastCurrencyUom, passwordHint, lastTimeZone, userLoginId,
externalAuthId, hasLoggedOut, isSystem, currentPassword,
requirePasswordChange, createdTxStamp, createdStamp, partyId, userLdapDn,
lastLocale, disabledDateTime, lastUpdatedTxStamp]
---: Service Result RES | RMAP - KEY: successiveFailedLogins
---: VALUE: null
---: Service Result RES | RMAP - KEY: enabled
---: VALUE: Y
---: Service Result RES | RMAP - KEY: lastUpdatedStamp
---: VALUE: 2013-10-11 22:57:19.849
---: Service Result RES | RMAP - KEY: lastCurrencyUom
---: VALUE: null
---: Service Result RES | RMAP - KEY: passwordHint
---: VALUE: null
---: Service Result RES | RMAP - KEY: lastTimeZone
---: VALUE: null
---: Service Result RES | RMAP - KEY: userLoginId
---: VALUE: admin
---: Service Result RES | RMAP - KEY: externalAuthId
---: VALUE: null
---: Service Result RES | RMAP - KEY: hasLoggedOut
---: VALUE: null
---: Service Result RES | RMAP - KEY: isSystem
---: VALUE: null
---: Service Result RES | RMAP - KEY: currentPassword
---: VALUE:
{SHA}47ca69ebb4bdc9ae0adec130880165d2cc05db1a
---: Service Result RES | RMAP - KEY: requirePasswordChange
---: VALUE: null
---: Service Result RES | RMAP - KEY: createdTxStamp
---: VALUE: 2013-10-11 22:57:06.338
---: Service Result RES | RMAP - KEY: createdStamp
---: VALUE: 2013-10-11 22:57:06.39
---: Service Result RES | RMAP - KEY: partyId
---: VALUE: admin
---: Service Result RES | RMAP - KEY: userLdapDn
---: VALUE: null
---: Service Result RES | RMAP - KEY: lastLocale
---: VALUE: null
---: Service Result RES | RMAP - KEY: disabledDateTime
---: VALUE: null
---: Service Result RES | RMAP - KEY: lastUpdatedTxStamp
---: VALUE: 2013-10-11 22:57:18.719
(btw: it is a demo ofbiz installation)
It is clear that they are obviously related:
Changing export=true to export=false
in
./framework/common/servicedef/services.xml
Changes the behavior, I cannot access it.
Sorry for confusion.
Did anybody worked on RMI access to OfBiz?
What I would like to achieve at the end is:
An interface that given admin credential can expose some data from OfBiz for
a given Party/User.
As you see, at present I have difficulties to even login!
My idea was that to call a service under given credentials, I need to get
some credentials first via
userLogin. But it looks like not to be the case.
Anybody with a similar problem?
cheers
F
--
View this message in context:
http://ofbiz.135035.n4.nabble.com/RMI-null-GenericValue-userLogin-problem-tp4645375p4645405.html
Sent from the OFBiz - User mailing list archive at Nabble.com.