Problems using Service.doInvoke(); - wM6.1

Hi everyone,

i got some problems coding an recursive java service in wM.

After searching the forum, I found the method Service.doInvoke in package com.wm.app.b2b.server.Service.

So i imported the package in my service and do a call like:

Service.doInvoke(“PATH:FLOWSERVICE”, “LISTOFVALUES”);

If I want to compile my service i got the following error message:

cannot resolve symbol
symbol : method doInvoke (java.lang.String,java.lang.String)
location: class com.wm.app.b2b.server.Service
Service.doInvoke("PATH:FLOWSERVICE
", "LISTOFVALUES");
^
1 error

:confused:

Someone can help at this?

Greets,
sx1911

On searching the web I found the following to convert the string path of my service to an NSName Object:

NSName svcName = NSName.create(“Path.to:yourService”);

But at least, i also get an error… :mad:

cannot resolve symbol
symbol : class NSName
location: class Test_daniel
NSName svcName = NSName.create("Path.to:yourService
");

did u import “com.wm.lang.ns.NSName” into your service .From the error u posted i guess its not recognising the class NSName.

HTH
srikanth

The com.wm.lang.ns.NSName and com.wm.app.b2b.server.Service package were imported in the service, yes.

Seems the JVM can’t find these packages?!

can u post the code ?

sx1911,

Regarding the first error you were getting:
cannot resolve symbol
symbol : method doInvoke (java.lang.String,java.lang.String)
location: class com.wm.app.b2b.server.Service
Service.doInvoke(“PATH:FLOWSERVICE”, “LISTOFVALUES”);

You got this error because the doInvoke method does not take two strings as input. There are different signatures for the doInvoke service, some of which take an NSName and some of which do not. If you don’t want to create an NSName object before calling doInvoke, then just use this signature of the method:

doInvoke(java.lang.String ifc, java.lang.String svc, IData input)

ifc = the path/folder name
svc = the service name
input = the pipeline object you want to give to the service

See the Java API Reference for more details.

  • Percio

In PSUtilities package there is one service to perform same operation , Please find snippet of the code below -

[highlight=java] IDataCursor idcPipeline = pipeline.getCursor();
IData inputData = null;
IData outputData = null;
String strServiceName = null;

try
{
  if (idcPipeline.first("serviceNS"))
  {
    strServiceName = (String) idcPipeline.getValue();
  }
  else
  {
    throw new ServiceException("missing service name");
  }

  if (strServiceName.length() == 0)
    throw new ServiceException("Invalid service name");

  if (idcPipeline.first("input"))
    inputData = (IData) idcPipeline.getValue();

  NSName nsName = NSName.create(strServiceName);

  outputData = Service.doInvoke(nsName, inputData);

  if (outputData != null)
    idcPipeline.insertAfter("output", outputData);

}
catch (Exception e)
{
  throw new ServiceException(e);
}
finally
{
  idcPipeline.destroy();
}[/highlight] 

Hope this helps !