Thanks Patrick,
The cast didn't blow, but I'm not sure it worked either.
I changed the variable for comparison - printed below.
It looks like it did what you described should happen but the subsequent call
to getService failed with $IenterpriseSession being undefined, like it's not
really what we had hoped it would be.
In this Java code:
boInfoStore = (IInfoStore) boEnterpriseSession.getService("", "InfoStore");
IInfoStore is the type that the boEnterpriseSession.getService("",
"InfoStore"); is being cast to (I think)
So I tried this:
$iStore = cast('com.crystaldecisions.sdk.occa.infostore.IInfoStore',
$IenterpriseSession)->getService("", "InfoStore");
But that failed:
Type casting can only be used on Java objects. Use 'coerce' instead.
Code with you suggested changes:
$sessionMgr =
com::crystaldecisions::sdk::framework::CrystalEnterprise->getSessionMgr();
$enterpriseSession = $sessionMgr->logon(userid, "password",
'td334.us.company.net:6400', secEnterprise);
print $enterpriseSession;
main::com::crystaldecisions::sdk::framework::internal::EnterpriseSession=HASH(0xe7f908)
$IentrepriseSession =
cast('com.crystaldecisions.sdk.framework.IEnterpriseSession',
$enterpriseSession);
print $IentrepriseSession;
main::com::crystaldecisions::sdk::framework::IEnterpriseSession=HASH(0xde9480)
$iStore = $IenterpriseSession->getService("", "InfoStore");
Can't call method "getService" on an undefined value
-----Original Message-----
From: Patrick LeBoutillier [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 08, 2008 8:04 PM
To: Vanole, Mike
Cc: Jason Stelzer; [email protected]
Subject: Re: Inline Java and the Business Objects SDK
Mike,
You're on the right track. The problem is that Inline::Java always
uses the base type and things can get a bit strange when an API is
constantly using interfaces as return types:
Try this:
my $sessionMgr =
com::crystaldecisions::sdk::framework::CrystalEnterprise->getSessionMgr();
my $enterpriseSession = $sessionMgr->logon(userid, "password",
'td334.us.company.net:6400', secEnterprise);
# Force Inline::Java to see $entrepriseSession as a
com.crystaldecisions.sdk.framework.IEnterpriseSession object, not it's
real "internal" type
$entrepriseSession =
cast('com.crystaldecisions.sdk.framework.IEnterpriseSession',
$enterpriseSession) ;
my $iStore = $enterpriseSession->getService("", "InfoStore");
Do this work better? If it does, you will probably need to keep on
casting the objects returned from methods to the type the API says it
returns.
Patrick
--
=====================
Patrick LeBoutillier
Laval, Québec, Canada