I tried to create a webservice using eclipse IDE.Since it shows some error on publishing the service to tomcat i did it with command .So now when im taking http: //localhost:8080/axis/servlet/AxisServlet My service is listed there.
http://localhost:8080/axis/services/fibonacci shows there is a webservice availabe. Can any one guide me how can i access my services from a jsp form. How to create one and where to deploy that jsp form in the axis runtime inorder to access the services.
Thanks and Regards Anuja K.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32767
posted
0
This article and this one have examples of web service clients which you can adapt. (The first one even has a Fibonacci-calculating example.)
It's not considered good design to embed WS accesses in JSP pages, though - a servlet would be more appropriate. And of course the JSP or servlet does not need to run inside the Axis web app - any web app will do.
Can any one tell me how can i access an already published webservice by some provider,
Regards Anuja K
anuja Edathu
Ranch Hand
Joined: Sep 09, 2005
Posts: 84
posted
0
Hi Ulf, I gone to the site following the link you provided .But what i don't understand is after creating the client how can i access it?
its given in the link Client: Write a Client That Uses the Generated Stubs to Easily Access the Web Service
package fibonacci;
public class FibonacciTester { public static void main(String [] args) throws Exception { // Make a service fibonacci.ws.FibonacciService service = new fibonacci.ws.FibonacciServiceLocator();
// Now use the service to get a stub to the service fibonacci.ws.Fibonacci fib = service.getFibonacci();
// Make the actual call System.out.println("Fibonacci(10) = " + fib.calculateFibonacci(10)); } }
how we can invoke the main() method of the FibonacciTeseter class. May be this sound too silly but im really confused.
Thanks & Regards, Anuja K.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32767
posted
0
The main method is called when you run the program from the command line like:
If the code is not part of an application (e.g. in a servlet), you can just move the 3 lines accessing the web service whereever you like.
I would advise to use a command-line client to access your web service while you are developing it.
anuja Edathu
Ranch Hand
Joined: Sep 09, 2005
Posts: 84
posted
0
Hi Ulf, I could run it using commandline client but How can we access it through browser?
Thanks , Anuja K.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 32767
posted
0
If you want to access it directly from the browser, you have to use the JavaScript XmlHttpRequest object. See some documentation here and here.
If you're talking about a web page that accesses the service, put the code in a servlet, as suggested earlier. [ November 03, 2005: Message edited by: Ulf Dittmer ]