How do I view the output from my Java service?

I’m using WebMethods 10. I built a simple Java service, which consists of the following …

public static final void DemoJavaUtil(IData pipeline) throws ServiceException {
	
	IDataCursor pipelineCursor = pipeline.getCursor();
	String input1 = IDataUtil.getString(pipelineCursor, "input1");
	int inputInt = Integer.parseInt(input1);
	Integer output = inputInt * 2;
	pipelineCursor.destroy();
	
	IDataCursor pipelineCursorOut = pipeline.getCursor();
	IDataUtil.put(pipelineCursorOut, "output1", output.toString());
	pipelineCursorOut.destroy();
	
}

In the “Input/Output” tab, I defined the expected input and output variables (as shown in the attached screen shot). However, when I run my service, by right clicking on it, selecting “Run As” -> “Run Service,” and then entering a value for my input, I don’t see the output variable defined anywhere. Where should that appear or waht else do I need to do so that I can verify its value?

Do you mind to share the whole package, so I could verify it on my local?

Sure thing. I wasn’t sure exactly what file/folder you wanted so I zipped up my demos package. It is attached. The service in question is “DemoJavaUtil”.
demos_package.zip (25.8 KB)

As per your code, even if you do not define the “output” in the input/output tab, then after successful run it should display the output1 in the pipeline.

As a webMethods Java service best practice, you can define the inputs and outputs first and generate the code where it genreates the code and can write your implemntation logic inside the generated code.

Refer the chap. “Building Java Services”

http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/designer/sdf10-3/10-3_Service_Development_Help.pdf

IDataCursor pipelineCursor = pipeline.getCursor();
String input1 = IDataUtil.getString(pipelineCursor, “input1”);
int inputInt = Integer.parseInt(input1);
Integer output = inputInt * 2;
pipelineCursor.destroy();

IDataCursor pipelineCursorOut = pipeline.getCursor();
IDataUtil.put(pipelineCursorOut, “output1”, output.toString());
pipelineCursorOut.destroy();

Hi, Where in the Pipeline tab should I see the results? I’ve attached a screen shot with the Pipeline tab selected. In my previous screen shot with the “Results” tab selected, you can see that only the “input1” value is displayed but I don’t see the “output1” value.

Also when I click on the tutorial ink you sent I got a 403 (Forbidden) error. Let me know if I need to open that as a separate thread.

Hi Tony,

I just tested with my 9.12 and it is working.
When running the service in Designer I can see input1 and output1 in the results tab.

The Pipeline tab will only contain information when developing flow services and you can do mappings on the flow steps in the pipeline tab.

See Service_Development_Help for further informations.

Regards,
Holger

What you shared is not a complete package, but the ns folder.

Hi Holger, I’m running version 10 so maybe my interface looks different? I attached two screen shots – the first is what I see when I click on my Java service from the package explorer and then click Run As -> Run Service. Then I click OK. The second screen is the results tab. There’s only input1. Maybe I have to do somethign else to see output1? Maybe you could attach what your screen looks like?

Xiaowei, Since I’m fairly new, could you give me step by step instructions of how to export the service from my Designer to a file that I can attach?

Thanks all,


Hi,

are there any Fixes applied to your installation?

Is it 10.1 or 10.3?

you might want to consider opening an incident on Empower to get this checked with SAG Support.

I am currently running on 9.12.

For testing I had created a new Java Service, defined input and output variables and copy the source code from above into the source tab.

After compiling the service I choose “Run Service”, entered input value and after execution was completed I can see input and output in the results tab.

Regards,
Holger

I just downloaded a trial version a few days ago so I assume it’s the latest (10.3)? Just my luck, already discovering errors in the IDE that I assumed were issues on my side because I’m new.

The code I posted above was tested on 10.4

HI Mahesh, Can you post a screen shot of what you have so I can compare to the screen shot that I posted on this thread? Maybe I’m not enabling something in the IDE? It’s supposed to be under “Results,” right and I shouldn’t need to link anything in the pipeline?