cancel
Showing results for 
Search instead for 
Did you mean: 

Can not syndicate with MDM JAVA API

Former Member
0 Kudos

Hi

I want to create the syndication java web component which does the same as SAP MDM Syndicator client.

The syndication class SyndicatePortCommand has no error messages. But I do not get XML file in the Port "ready" folder.

The MDM JAVA version is MDM_JAVA_API 710 SP5 (1000.710.0.5.99.20101008052600)

What is wrong in my code?

Thanks

Dan

My code is

// create connections pool to a MDM server
String serverName = "myServerName";
ConnectionPool connections = null;
try {
    connections = ConnectionPoolFactory.getInstance(serverName);
 } catch (ConnectionException e) {
    e.printStackTrace();
    return;
};

// specify the repository to use
String repositoryName = "myRepositoryName";
String dbmsName = "dbmsName";
RepositoryIdentifier reposId = 
    new RepositoryIdentifier(repositoryName, dbmsName, DBMSType.ORACLE);

// get list of available regions for the repository
GetRepositoryRegionListCommand regionListCommand = 
    new GetRepositoryRegionListCommand(connections);
regionListCommand.setRepositoryIdentifier(reposId);
try {
    regionListCommand.execute();
} catch (CommandException e) {
    e.printStackTrace();
    return;
}
RegionProperties[] regions = regionListCommand.getRegions();
RegionProperties region = regions[0];
		
// create a user session
String sessionId = "";
CreateUserSessionCommand sessionCommand =
new CreateUserSessionCommand(connections);
sessionCommand.setRepositoryIdentifier(reposId);
sessionCommand.setDataRegion(region);
try {
    sessionCommand.execute();
} catch (CommandException e6) {
    // TODO Auto-generated catch block
    e6.printStackTrace();
}
sessionId = sessionCommand.getUserSession();

// authenticate the user session
String userName = "userName";
String userPassword = "userPassword";
AuthenticateUserSessionCommand authCommand =
    new AuthenticateUserSessionCommand(connections);
authCommand.setSession(sessionId);
authCommand.setUserName(userName);
authCommand.setUserPassword(userPassword);
try {
    authCommand.execute();
} catch (CommandException e) {
    e.printStackTrace();
    return;
}

// event dispatcher
try {
    EventDispatcher eventDispatcher = new EventDispatcher(serverName);
    MyRepositoryEventListener reposListener =
        new MyRepositoryEventListener();
    eventDispatcher.addListener(reposListener);
    eventDispatcher.registerRepositoryNotifications(
        userName,
        userPassword,
        reposId);
} catch (ConnectionException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
} catch (CommandException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

// get port
GetPortListCommand getPortsCmd = new GetPortListCommand(connections);
getPortsCmd.setSession(sessionId);
try {
    getPortsCmd.execute();
} catch (CommandException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
}
PortProperties[] portList = getPortsCmd.getPorts();
String portCode = "myPort";
// search a specific portCode
PortProperties port = null;
for (int i = 0; i < portList.length; i++) {
    if (portCode.equals(portList<i>.getCode())) {
        port = portList<i>;
        break;
    }
}
if (port == null) {
     throw new RuntimeException("Can't syndicate, port doesn't exist");
}

// call syndication
// expected to produce xml file in Port, but it DOES NOT
String filePrefix = "Data_";
SyndicatePortCommand syndicatePortCommand =
    new SyndicatePortCommand(connections);
syndicatePortCommand.setSession(sessionId);
syndicatePortCommand.setFilePrefix(filePrefix);
syndicatePortCommand.setPortId(port.getId());
syndicatePortCommand.setRemoteSystemId(port.getRemoteSystemId());
try {
    syndicatePortCommand.execute();
} catch (CommandException e4) {
    e4.printStackTrace();
}

// should retrieve the syndicated records as described from http://help.sap.com/javadocs/MDM71/syndication.html
// but in the real world, it moves xml file  (produced by SAP MDM Syndicator client) from ready folder to archive folder which is wrong
GetPortDataFilesCommand getPortDataFilesCommand =
    new GetPortDataFilesCommand(connections);
getPortDataFilesCommand.setSession(sessionId);
getPortDataFilesCommand.setRemoteSystemId(port.getRemoteSystemId());
getPortDataFilesCommand.setPortId(port.getId());
getPortDataFilesCommand.setFilePrefix(filePrefix);
try {
    getPortDataFilesCommand.execute();
} catch (CommandException e5) {
    // TODO Auto-generated catch block
    e5.printStackTrace();
}

Edited by: dansapexpert on May 31, 2011 5:24 PM

Edited by: dansapexpert on May 31, 2011 5:34 PM

Edited by: dansapexpert on May 31, 2011 5:40 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello dansapexpert

Check in your syndication map parameter "suppress unchanged records"

I think, you files(in you outbount port archive folder don't have some data.

if you file was placed in archive folder this is mean syndicatoin process has finished successful but file has no some data.

Regards

Kanstantsin Chernichenka