on 07-22-2009 12:43 PM
Hi All,
Im using MDM 5.5 SP6 and the API for the same in a Portal component.
When trying to retrieve records, I was getting an error: The current Protocol operation is not supported for the session specified.
So I read that I could use CreateUserSessionCommand..
So, I tried:
ConnectionAccessor sc=null;
sc = SimpleConnectionFactory.getInstance(sHostName);
RegionProperties regionProperties = new RegionProperties();
regionProperties.setLocale(Locale.ENGLISH); regionProperties.setName("English [US]");
regionProperties.setRegionCode("engUSA");
CreateUserSessionCommand createUSesCmd = new CreateUserSessionCommand(sc);
But the last line doesnt allow me to move forwards because CreateUserSessionCommand doesnt accept ConnectionAccessor as a parameter
ANy help ?
Hi,
sc should be a SimpleConnection :
SimpleConnection sc = null;
Regards,
Pierre
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
use import com.sap.mdm.net.SimpleConnection; while importing
and SimpleConnection Object in createUserSession Commands constructorwhile creating object.
I think it will solve ur problem.
Regards,
Vibha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prem,
There are two classes with name CreateUserSessionCommand.... in MDM Java API jars...
One is com.sap.mdm.commands.CreateUserSessionCommand,
And another is com.sap.mdm.internal.protocol.commands.meta.CreateUserSessionCommand...
The code which you have written, should work fine if you are using first one...
Make sure you have no import packages referring to any class in com.sap.mdm.internal package...
Regards,
- Shailesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
here is how I am using the SP6 API:
UserSessionContext userSessionCtx = new UserSessionContext(hostName, repositoryName, language, userName);
String userSession = SessionManager.getInstance().createSession(userSessionCtx, SessionTypes.USER_SESSION_TYPE, pwd);
// get the repository schema
GetRepositorySchemaCmd cmd = new GetRepositorySchemaCmd(userSessionCtx);
cmd.setSession(userSession);
cmd.execute();
RepositorySchema repoSchema = cmd.getRepositorySchema();
I realize it is not exactly what you are trying to do, but the above code works for me.
The command constructor takes the UserSessionContext object as its arg,
and you set the session to the user session var.
Hope this helps!
Bruce Berkowicz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bruce,
I saw you post both this and a similar thread regarding connections to the repository. Like you, I am trying to connect to MDM from a web application (in this case, Liferay Portal running on Tomcat). I've had the same problems you have regarding best practices for making a connection. I'm currently using the same process you described above (create a UserSessionContext object then create the session), but I'm seeing connections pile up on the server. I'm thinking I have to implement a cache model on the connection object but it's not clear which one actually creates the connections.
Have you tried the MDM Connector object? That seems to be the preferred way to make a JCA Connection, but I can't find any good documentation on how to set it up in my environment. All of the SAP documentation points to using either SAP Portal or an environment with NWDI.
Any insight you might have on how to properly make a connection in a non-SAP Java web environment would be greatly appreciated!
Shawn
Hi Prem,
Try using "Connectionpool" from Connectionpoolfactory class.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this.... didnt work
ConnectionPool sc=null;
sc = ConnectionPoolFactory.getInstance(sHostName);
//sc = SimpleConnectionFactory.getInstance(sHostName);
RegionProperties regionProperties = new RegionProperties();
regionProperties.setLocale(Locale.ENGLISH); regionProperties.setName("English [US]");
regionProperties.setRegionCode("engUSA");
CreateUserSessionCommand createUSesCmd = new CreateUserSessionCommand(sc);
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.