webMethods 10.7 trial - java service issue

Hi Friends,

I am trying to exploring 10.7 trial version and while using the java service I am facing a weird exception or issue

I have created a java service with below details
Java service —start
with in put - inputInts (string list) and output - testInt
public static final void sumOfMarks(IData pipeline) throws ServiceException {
IDataCursor pipelineCursor = pipeline.getCursor();
String inputInts = IDataUtil.getStringArray( pipelineCursor, “inputInts” );

		int ttestInt=0;
	
		for (int i=0;i<inputInts.length;i++)
		{
			ttestInt=ttestInt+Integer.valueOf(inputInts[i]);
		}
		IDataUtil.put( pipelineCursor, "testInt", ttestInt);
		pipelineCursor.destroy();

The java service is working fine and giving the expected results
the issue is when I am calling this java service in an IS service / flow

here the branch condition is working fine (testInt >5, here testInt is the output of java service) and when I am passing the same value to addInts service I am getting the exception as shown in picture parameter num1 is missing.

Not only with this service, I have created another couple of java services but facing the same issue. Please suggest.

thanks,
Madhava

Hi,

can you provide the input/output Signature of the servie test please?

Did you try to debug the service test to see at which step it fails?

I assume that your service test has a mandatory input named num1 which is not set when running the service.

Regards,
Holger

HI
You need to convert the integer to string in output ,make the changes in the java service as below.

                                  int ttestInt=0;		        
			for (int i=0;i<inputInts.length;i++)
			{
				ttestInt=ttestInt+Integer.valueOf(inputInts[i]);
			}
			String s =String.valueOf(ttestInt);
			IDataUtil.put( pipelineCursor, "testInt", s);
			pipelineCursor.destroy();

Can simplify:

int ttestInt=0;		        
for (int i=0;i<inputInts.length;i++)
{
    ttestInt=ttestInt+Integer.valueOf(inputInts[i]);
}
IDataUtil.put( pipelineCursor, "testInt", ttestInt+""); // This will convert the int to a string
pipelineCursor.destroy();

Side note: I know you’re just using this to explore, but adding a list of numbers does not need to be done in Java. You can do it with FLOW very much the same way.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.