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

ovsd4.5 web-api, how to use ?

SOLVED
Go to solution
Highlighted
hudaming
Acclaimed Contributor

ovsd4.5 web-api, how to use ?

my system is : win2003, hpovsd4.5 pk16, jdk1.4.2_06

this is my first time to use web-api.

my code is :
----------------------------

import com.hp.itsm.api.*;
import com.hp.itsm.api.interfaces.*;

public class ovsdapi
{

public static void main(String args[]) {

String server = "localhost";
String username = "test";
String password = "test";
ApiSDSession session = null;

try {
session = ApiSDSession.openSession(server, username, password);
} catch (RuntimeException e) {
System.out.println("Error:");
System.out.println(e.getMessage());
return;
}

IAccount account = session.getCurrentAccount();

}

}

--------

javac ovsdapi.java -> passed
java ovsdapi -> caught an exception

the exception is as follow:
Error:
Failed reading response from the server.
------

why do i caught this exception? how can i solve it ?

when i change a username that does not exist, the exception will be :
... username/password wrong ...
-------

so the user certification has passed, but why does it fail reading response from the server ?

could anybody help me ?~~~
2 REPLIES
Mike Bush
Honored Contributor
Solution

Re: ovsd4.5 web-api, how to use ?

The most common cause of "failed reading response" is when the service pack for the server is out of synch with the web api code you are running.
hudaming
Acclaimed Contributor

Re: ovsd4.5 web-api, how to use ?

thank u very much, mike !

i've got the reason.
the web-api.jar file i use is the file on the ovsd-setup-cdrom. but my server is running on sp16.

so the version is not compatible.
when i change my classpath to the newest web-api.jar file, there's no exception after all.
//Add this to "OnDomLoad" event