Invoking a service from WmART

Hi All,
I am trying to invoke a service from WmART package within my service to get the polling interval for that instance…

ServiceThread doThreadInvoke = Service.doThreadInvoke(NSName.create(“pub.art.notification:queryPollingNotificationState”), sourceData);

But, when i try to access the result, it is giving me Access Exception : Access Denied.

Whether, i can invoke services from WmART…?

Any pointers on this issue…

Regards, Aravind

You can invoke services within the WmART package (the service you’re calling is described in the Built-In Services Reference and so is a public service) but to invoke the services you must have a valid session. The form of doThreadInvoke you’re using does not accept a session var and so can only call public/unprotected services. Use the method that accepts a session object.

Hi Reamon,

we are actually defining adapter for tamino database and defining a service for polling, i need to consume the polling interval mentioned in IS Admin Screen for my Tamino Adapter.

Do you have any idea of getting the session object…?

Thanks for your reply…

Regards, Aravind

Are you creating an adapter using the ADK? Or are you using another adapter, creating a connection and adapter service for with that?

Might the call to get the polling interval be done outside the Java service and the value of the interval passed in?

To retrieve config values would doInvoke work better? I’m not sure there is value in doing a threaded call.

Hi Reamon,
we are using ADK for our adapter development and our polling class extends WmPollingNotification…

How can i get the time schedule entered for the polling notification in the IS AdminScreen into my polling class…?

Regards, Aravind

Isn’t the connection config passed to your adapter method? Or available via an ADK call? Are you sure you need it? I ask because I think the ART takes care of calling your polling notification every configured time period, it isn’t something you need to do explicitly. But I may be wrong. The ADK docs should have the answer.

Using doInvoke instead doThreadInvoke may work.

Hi Reamon,
IS manages the call(polling call) made according to the interval specified.we need that time interval to place in the tamino query which executes as a result of polling.

One thing we found is, it is not only this service(queryPollingNotificationState)… we are not able to even call a simple service from the public folder( for ex we tried calling pub.string:length, it also gives us AccessException…)

we concluded that inside our polling class, we aren’t able to call any built-in services…

Any clues on this…

Regards, Aravind

That sounds right since the adapter implementation does not run within the context of a session.

In reviewing the ADK User’s Guide, you should be able to retrieve the connection metadata from the connection that your notification class retrieves via retrieveConnection(). In this case you’re after “notificationInterval” I think. I think this is the way to go rather than trying to use built-in services from WmART.

Hi Reamon,

retrieveConnection() is ain’t working for that…

ManagedConnectionMetaData metaData = retrieveConnection().getMetaData();
System.out.println(“connectionMetaData:”+metaData.getUserName());

(and tried the below one too)

ManagedConnectionMetaData metaData = ((TaminoConnection)retrieveConnection()).getMetaData();
System.out.println(“connectionMetaData:”+metaData.getUserName());

In the code snippet you have sent, iam getting ClassCastException for NSName in the s.invoke() method…?

Thanks for the replies… really helpful for us…

Regards, Aravind

Can you describe how it isn’t working? What is the error?

For the ClassCastException, are you sure it is for the NSName? What version of IS are you using?

Hi Reamon,

ManagedConnectionMetaData metaData = retrieveConnection().getMetaData();
System.out.println(“connectionMetaData:”+metaData.getUserName());

For this line…It is just printing null… Error : Null in the IS Console.

Iam using IS 7.1… Yeah, in the console and the log file shows classcastexception for NSName.

Regards, Aravind

Can you post the exception stack trace for me? That may help me figure out what needs to change.

Hi Reamon,

Below are the sysout messages and the stacktrace of the exception.

Session Created: a891bc80386111dea8b9864ba00f3475
After invoking service: testServices:testTAIPollingAdministrator{sha1}vI5TC3V31V
doYdyukqpb7AYXHXQ=
Before s.invoke(user, NSName.create(serviceName), Values.use(input));

java.lang.ClassCastException: com.wm.lang.ns.NSName
at com.wm.pkg.art.util.ExtendedNotificationUtils.queryPollingNotificatio
nState(ExtendedNotificationUtils.java:1385)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:403)
at com.wm.app.b2b.server.invoke.InvokeManager.process(InvokeManager.java
:631)
at com.wm.app.b2b.server.util.tspace.ReservationProcessor.process(Reserv
ationProcessor.java:40)
at com.wm.app.b2b.server.invoke.StatisticsProcessor.process(StatisticsPr
ocessor.java:44)
at com.wm.app.b2b.server.invoke.ServiceCompletionImpl.process(ServiceCom
pletionImpl.java:241)
at com.wm.app.b2b.server.invoke.ValidateProcessor.process(ValidateProces
sor.java:51)
at com.wm.app.b2b.server.ACLManager.process(ACLManager.java:228)
at com.wm.app.b2b.server.invoke.DispatchProcessor.process(DispatchProces
sor.java:30)
at com.wm.app.b2b.server.AuditLogManager.process(AuditLogManager.java:62
4)
at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:
536)
at com.wm.app.b2b.server.invoke.InvokeManager.invoke(InvokeManager.java:
381)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:237)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:119)
at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:91)
at com.wm.app.b2b.server.SessionInvoke.run(Session.java:837)
at com.wm.util.pool.PooledThread.run(PooledThread.java:118)
at java.lang.Thread.run(Thread.java:595)

Regards, Aravind