This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Help needed on Web services  RSS feed

 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm using MySQL db.

I have the following connection details in MySQL.

newconnection1 , User : Root, Host:127.0.0.1:3307

and I've the following statement in my java project:



When I deploy the app in Netbeans, the Java DB Database process in Output shows this message:
2011-04-19 20:33:39.262 GMT : Security manager installed using the Basic server security policy.
2011-04-19 20:33:43.930 GMT : Apache Derby Network Server - 10.5.3.0 - (802917) started and ready to accept connections on port 1527


The Glassfish server instance shows this message :
INFO: BookWS was successfully deployed in 959 milliseconds.


and BookWS (run-deploy) shows this:
BUILD SUCCESSFUL (total time: 1 minute 4 seconds)


When I click on Test Web Service, I get the below message:
Unable to open web service tester page:
http://localhost:8080/BookWS/BookWSService?Tester
Make sure the service has been deployed successfully, and the server is running.


What should be the reason for this message as I'm following all the steps as mentioned.
Does Web service in Netbeans need any setup before we can proceed with it?

Please advise.

Thank you.
 
Rick Roberts
Ranch Hand
Posts: 59
Hibernate Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See if you can get to this URL:
http://localhost:8080/BookWS?wsdl

If so, then it has deployed correctly.

After that you need a webservice client that can call the methods.
The only method you have is getBookDetails()

I dont see anything in your code that would resolve to:
http://localhost:8080/BookWS/BookWSService?Tester
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rick,

How are you ?

Sorry for the delay in the response.

I can see the message that "BookWS was successfully deployed in 865 ms" in Netbeans Glassfish server 3 output window.

But the link you have mentioned below shows the message " this links appears to be broken."
So does it mean the app wasn't deployed at all.

When I do Test web service on BookWS, I get this alert box:
"Unable to open web service tester page:
http://localhost:8080/BookWS/BookWSService?Tester

Make sure the service has been deployed successfully and the server is running."

You have mentioned this link, but I'm following the code given in the book and there is nothing else mentioned apart from the code I have written and yet it runs fine.

Please advise.

 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rick,

I came across this advice on this forum only :
A first test to make sure the web service is correctly deployed is to bring up its WSDL.
If there is no WSDL, then the web service has not been deployed correctly.
This test can be performed from any browser, before using the web service tester.


Also, you have mentioned that :
I dont see anything in your code that would resolve to:
http://localhost:8080/BookWS/BookWSService?Tester


Could you please tell me more on this error.

Thanks.
 
Rick Roberts
Ranch Hand
Posts: 59
Hibernate Java Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im late getting back to you. You have probably moved on by now but if not:

Try something simple like:

import javax.jws.WebService;

@WebService
public class EchoWS {
public String echo(String echo) {
return echo;
}
}

Deploy that and watch in the Tomcat logs for something like:
WSDL deployed to (or created in) {some folder}

That will be the WSDL file that Tomcat generates for you.

Tomcat then publishes that file for you at something like:

http://localhost:8080/EchoWS?wsdl

If all that happens, you still need a webservice client to call the echo() method.
Your client can be a web app (jsp/servlet, etc) or a plain old java client using RMI.
You should be able to Google around a bit and find lots of examples.

I hope you already got past this but if not, maybe this helps a little.

Good Luck
 
Pankaj Kumarkk
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pramod,
You can check first whether the code has been deployed as a web service or not. You can verify this by doing below:
1) Login to glassfish admin console : http://localhost:4848
2) Click the "applications" link
3) Check that your application has been deployed as a web service(look for a value "web service" under the "Engines" column. If it doesn't show "web service" this means that your application is not deployed as a web service.

are you using Eclipse+glassfish as the environment?

if yes then i would suggest that do the following:
Create a new workspace in Eclipse
then follow Rick Roberts's instruction.

Hope it helps.

Thanks,
Satish
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!