Page 1 of 1

Error: A WebService annotation is not present on class: com.

PostPosted:Wed Apr 07, 2010 8:30 pm
by janetao2000
Hi, guys:
I installed openKm in one pc 'A', and in another pc 'B', I generate a webservice client jar file, run a java application to call 'A''s webservice. Initially, the client can't access to openKm webservice, throwing connection timeout error. After I can add 'A's external IP and domain name to the file 'hosts', it works well.

Yet if I call openKm webservice from a web application (deployed to jetty, use mvn run it) instead of java application, then
Code: Select all
OKMAuthService okmAuthService = new OKMAuthService();
OKMAuth okmAuth = okmAuthService.getOKMAuthPort();
calling okmAuthService.getOKMAuthPort() will throw RuntimeModelerException: "A WebService annotation is not present on class: com.openkm.ws.client.OKMAuth".

Someone knows what cause it and how to solve it?

Regards,

Jane

Re: Error: A WebService annotation is not present on class:

PostPosted:Thu Apr 08, 2010 3:17 pm
by jllort
I don't know what are you doing but seems something strange.

Normally you might use like :
Code: Select all
OKMAuthService okmAuthService = new OKMAuthService();
String token =  okmAuthService.login("user","pass");
If you've generated classes with wsdl, you might change some localhost:8080/OpenKM fixed in class for some external and configurable variable (remote accessing ).

Re: Error: A WebService annotation is not present on class:

PostPosted:Fri Apr 09, 2010 6:11 am
by pavila
If you call a SOAP method located in another host different from where you generated the java stuf from WSDL, try:
Code: Select all
OKMAuthService okmAuthService = new OKMAuthService();
OKMAuth okmAuth = okmAuthService.getOKMAuthPort();
BindingProvider bp = (BindingProvider)okmAuth; 
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url+"/OKMAuth");

Re: Error: A WebService annotation is not present on class:

PostPosted:Fri Apr 09, 2010 5:03 pm
by janetao2000
Thanks all for your reply. After several tests, I think that the error is caused by classpath settings. Right now we use jetty to run our web application, which will call remote openKm web service. Yet when running the line OKMAuth okmAuth = okmAuthService.getOKMAuthPort();
It fails. I deployed the same application war to tomcat, then no problem.
So my current questions is how to get classpath running under jetty and compare it with one under tomcat. (We need use jetty).

Re: Error: A WebService annotation is not present on class:

PostPosted:Fri Apr 09, 2010 7:53 pm
by jllort
With what have you generated webservices classes ?

I've tryed with java and with windows ( C# ) with wsdl ... what have you used

Re: Error: A WebService annotation is not present on class:

PostPosted:Fri Apr 09, 2010 9:14 pm
by janetao2000
I am using java under windows xp. To generate ws client stubs, using the following cmds:
wsimport -s . -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMAuth?wsdl
wsimport -s . -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMDocument?wsdl
wsimport -s . -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMFolder?wsdl
wsimport -s . -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMSearch?wsdl
wsimport -s . -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMNotification?wsdl
wsimport -s . -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMRepository?wsdl

Then, you can get the generated source codes and compiled classes.
BTW, wsimport is only available under jdk 1.6+.

Re: Error: A WebService annotation is not present on class:

PostPosted:Mon Apr 12, 2010 6:06 am
by janetao2000
It works on Tomcat after I deployed the same war to it. So I think that it comes from Jetty. It has some conflict with client stubs generated by jdk 1.6

Re: Error: A WebService annotation is not present on class:

PostPosted:Mon Apr 12, 2010 5:57 pm
by jllort
Yes it could be some problem on it. The same webservices declaration present in OpenkM 4.0 - jboss 4.0 has problems with jboss 5.0, really jboss webservices sometimes could be tedious.

If it's derived from some classes problem you could try to isolate application ( I don't know if it could solve something ).