on 02-13-2009 5:48 AM
HI All,
I am working with webdynpro and MDM java API. I had added the respecive jars and now i want to test whether i am able to make a connection to the MDM server.
Please provide me the sample code.
Thanks,
Jyothi.
use this blog
/people/tobias.grunow/blog/2007/12/18/mdm-java-api-2-an-introductive-series-part-ii
/people/udi.katz/blog/2005/08/21/retrieving-data-from-mdm-server-using-the-mdm-java-api
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
check this
http://help.sap.com/javadocs/MDM/SP06/com/sap/mdm/net/package-summary.html
http://help.sap.com/javadocs/MDM/SP06/com/sap/mdm/examples/package-summary.html
/people/udi.katz/blog/2005/07/17/mdm-connectivity-to-java-application
/people/sap.user72/blog/2006/05/01/use-mdm4j-to-automatically-update-a-mask
http://searchsap.techtarget.com/generic/0,295582,sid21_gci1232154,00.html#
bvr
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jyothi,
Below is the code for connection to mdm repository.
public void getRepositoryConnection(
java.lang.String hostName,
java.lang.String repositoryName,
java.lang.String userId,
java.lang.String passWord) {
//@@begin getRepositoryConnection()
try {
if (simpleConnection == null) {
simpleConnection =
SimpleConnectionFactory.getInstance(hostName);
System.out.print("Successfull 1");
// Establish TCP Connection to the server
if (simpleConnection != null) {
// WorkflowId workflowId = new WorkflowId(99998);
// CreateWorkflowJobCommand createWorkflowJobCommand =
// new CreateWorkflowJobCommand(simpleConnection);
// createWorkflowJobCommand.setWorkflowId(workflowId);
// wdComponentAPI.getMessageManager().reportSuccess("Got Connected");
/** Establish a repository session with the respository */
//Set the region properties
RegionProperties dataRegion = new RegionProperties();
/** Set region code for the session */
dataRegion.setRegionCode("engUSA");
/** Set the locale on data region */
dataRegion.setLocale(new Locale("en", "US"));
/** Set the name of data region */
dataRegion.setName("US");
// Createa repository identifier
RepositoryIdentifier repositoryID =
new RepositoryIdentifier(
repositoryName,
hostName,
DBMSType.MS_SQL);
System.out.print("Successfull 2");
/** Create the User Session */
CreateUserSessionCommand createUserSessionCommand =
new CreateUserSessionCommand(simpleConnection);
/** Set the repository identifier (mandatory)*/
createUserSessionCommand.setRepositoryIdentifier(
repositoryID);
/** Set the region properties for the session (mandatory) */
createUserSessionCommand.setDataRegion(dataRegion);
System.out.print(
"Successfull 3" + repositoryID.getDBMSType());
createUserSessionCommand.execute();
System.out.print("Successfull 4");
/** Get the session identifier */
userSession = createUserSessionCommand.getUserSession();
System.out.print(
"Successfull.................." + userSession);
AuthenticateUserSessionCommand authenticateUserSessionCommand =
new AuthenticateUserSessionCommand(simpleConnection);
/** Set session identifier (mandatory)*/
authenticateUserSessionCommand.setSession(userSession);
/** Set id of repository user(mandatory) */
authenticateUserSessionCommand.setUserName(userId);
/** Set password (mandatory)*/
authenticateUserSessionCommand.setUserPassword(passWord);
System.out.print(
"Successfull.................."
+ authenticateUserSessionCommand.getUserName());
/** Establish the session */
authenticateUserSessionCommand.execute();
SetUnicodeNormalizationCommand unicodeNormalizationCommand =
new SetUnicodeNormalizationCommand(simpleConnection);
unicodeNormalizationCommand.setSession(userSession);
unicodeNormalizationCommand.setNormalizationType(
SetUnicodeNormalizationCommand.NORMALIZATION_COMPOSED);
unicodeNormalizationCommand.execute();
CreateRepositorySessionCommand repositorySessionCommand =
new CreateRepositorySessionCommand(simpleConnection);
/** Set the repository identifier */
repositorySessionCommand.setRepositoryIdentifier(
repositoryID);
/** Obtain repository session */
repositorySessionCommand.execute();
/** Store the session id into the variable repositorySession */
this.repositorySession =
repositorySessionCommand.getRepositorySession();
/** Authenticate the users session */
AuthenticateRepositorySessionCommand authenticatedRepositorySession =
new AuthenticateRepositorySessionCommand(simpleConnection);
/** set the session id */
authenticatedRepositorySession.setSession(
repositorySession);
/** set id of the repository user */
authenticatedRepositorySession.setUserName(userId);
/** set password */
authenticatedRepositorySession.setUserPassword(passWord);
authenticatedRepositorySession.execute();
/** Get the Repository schema */
GetRepositorySchemaCommand repositroySchemaCommand =
new GetRepositorySchemaCommand(simpleConnection);
repositroySchemaCommand.setSession(repositorySession);
repositroySchemaCommand.execute();
this.schema = repositroySchemaCommand.getRepositorySchema();
}
}
} catch (Exception e) {
e.printStackTrace();
}
//@@end
}
Regards
Narendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.