UERGENT:invoke a service with a dynamic name space

How can I invoke a service that the service namespace is dynamic. ie, the namespace is build in a string. I guess I should not use the pub.remote.invoke since this is for a “remote” Call.

Thanks
Bert

Use a custom Java Service that looks a lot like this:

String host = “hostname:port”;
String user = “username to connect as”;
String pass = “password for username”;
String ifc = “serviceFolder”;
String svc = “serviceName”;

Context c = null;
try {
c = new Context();

c.connect(host, user, pass);
ValuesEmulator.put(pipeline, "result", c.invoke(ifc, svc, IDataFactory.create()));
c.disconnect();

} catch (Exception e) {
if (c != null) {
try {
c.disconnect();
} catch (Exception ee) {
// ignore this…
}
}
throw new ServiceException("Error during invoke: " + e.getMessage());
}

Looks OK but It will be call inside a service so Don’t need to pass the user/password!

You should create a Java service that takes the name of the service and the portion pipeline that you want to pass it and returns the results of the service execution. The code snippet would look something like:

IDataCursor cursor = pipeline.getCursor();
IData servicePipeline = IDataUtil.getIData(cursor, “serviceInput”);
String serviceName = IDataUtil.getString(cursor, “serviceName”);

IData results = null;
try {
results = Service.doInvoke(NSName.create(serviceName), servicePipeline);
IDataUtil.put(“results”, results);
} catch (Exception e) {
throw new ServiceException(e);
} finally {
cursor.destroy();
}