Service Desk Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Running HP's web API examples

SOLVED
Go to solution
Highlighted
David Iannucci
Regular Collector

Running HP's web API examples

I've searched this forum, but can't seem to find the answer to what's plaguing me.

I'm starting to learn how to write to the SD web API, and thought I would try to get the examples that come on the CD to work first. Got 'em all compiled, but when I run them, I get back the message "Failed reading response from the server."

I have a pretty good idea that my client code is actually talking to the server, though, because if I put in a wrong password to one of these examples, it tells me the password is wrong, rather than giving the above error.

I'm running the examples from Linux. All I've done is compile them, and run from a shell command line, with web-api.jar in the classpath. Am I missing something important here? If so, it's not mentioned in the documentation.

Can anybody give me a clue what's wrong?

Thanks,
Dave
Don't believe everything you think.
4 REPLIES
Jasper Verweij
Honored Contributor
Solution

Re: Running HP's web API examples

Dave,

The error message "Failed reading response from the server." occurs most of the times when your web-api.jar is not from the same servicepack as the server is running.

Another possible root cause is the following. Go to the installation directory of your SD app server %SD_SERVERHOME$ and go to lib directory.

When we are upgrading to a newer servicepack we are mainly focused on the file 'servicepack.jar', but for api connections the files 'api-common.jar' and 'api-server.jar' should be updated as well. So please check if these two files have the same modified date as your servicepack.jar

Good luck,

Jasper
jamxav
Regular Collector

Re: Running HP's web API examples

Another reason for these issues is also related to the webapi.jar. You need to specify it when you run the command. Let me show you how I do it in windows,then you can try the same on your linux env:

Compile with -->
C:\Program Files\Hewlett-Packard\OpenView\service desk 4.5\server\lib>javac -classpath .\web-api.jar ..\..\api\Example1.java

Run with -->
C:\Program Files\Hewlett-Packard\OpenView\service desk 4.5\api>java -cp .;..\server\lib\web-api.jar Example1 hostname user password

Please note -cp parameter.

Hope it helps
David Iannucci
Regular Collector

Re: Running HP's web API examples

Turns out I didn't have the right web-api.jar for the SP. Strange, because I thought for *sure* that I was using the right one. Oh well. Thanks much for the help.

Dave
Don't believe everything you think.
Michael Hamelra
Occasional Contributor

Re: Running HP's web API examples

I am starting to work with HP OVSD Web API â ¦ Its my understanging I need to download the apporiate service pack based on the version of OVSD I am on: OVSD 4.5 SP17

Could help me locate Web API service pack â ¦maybe a URL

I work for HP can NOT locate the web-api.jar
All I have is OVSD Client on my pc that connects to the
michael.hamelrath@hp.com
//Add this to "OnDomLoad" event