Service Desk Practitioners Forum

Java web-api execution

Go to solution
Super Contributor.

Java web-api execution


I've a new problem:

I execute all Examples that are privided in the web-api directory, but at the end of the execution they are not finished by theirself, but I have to press CONTROL+C to finish the execution.

Any idea abut what is happening?

Thanks, Carlos
Ganesha Sridhar
Outstanding Contributor.

Re: Java web-api execution

Hello Carlos,

I have tried the file which comes with WEB-API SDK, and the program executed without waiting for "Ctrl + C" key.

Please can you send me your Example file, so that I can try the same here.

I have attached the which I have executed (I have not modified anything in this example file).

Ganesha Sridhara
Super Contributor.

Re: Java web-api execution

Hi Ganesha,

Thanks for your answer.

I've compiled and executed your example and the problem is there.

My compilation lines are:
$ javac -classpath ..\web-api.jar
$ java -cp ..\web-api.jar;. Example1 localhost CARLFRE servicedesk

I don't know exactly what is the problem, becouse i execute the example, and the prompt is not displayed, but I can write (without seeing my lines) and waht i write is executed.

For example:
- I execute java example
- No prompt is showed
- I write dir command and enter(for example)
- I execute java -version and enter(for example)
- I don't see anything
- I press CONTROL+C
- The prompt is showed and the dir and java -version commands had been executed.

So the problem is that the system don't show the prompt, but I think that the java example finish its executation.

Any Idea

Note: I don't enclose my file becouse the error is the same than with yours

Ciao, Carlos
Super Contributor.

Re: Java web-api execution

Just one more detail.

If I execute another example(not included in servicedesk examples and without relation with service desk) it finish its execituion normally.

I enclose that stupid (very simple) file

Maybe this helps
Valued Contributor.

Re: Java web-api execution

i have the same problem. I solved it by adding line

To the end of main function.
Now it wont wait until CTRL+C.
Super Contributor.

Re: Java web-api execution

Hi, I had already solved it but I forgot close this thread.

Thanks anyway.

The problem was that I was writing return; instead you must use System.exit(n);

That examples works if you execute them from service desk as the result of a rule (as a command action).

The problem was that return doesn't give you back the promt, but when you use the script in a rule, you don't need the prompt.

That's all. Thanks

Carlos from Spain
Super Contributor.

Re: Java web-api execution

Closed ;)