File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Webservices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Webservices" Watch "Webservices" New topic
Author

Webservices

anuja Edathu
Ranch Hand

Joined: Sep 09, 2005
Posts: 84
Hi all,

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: 41601
    
  55
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.


Ping & DNS - my free Android networking tools app
anuja Edathu
Ranch Hand

Joined: Sep 09, 2005
Posts: 84
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
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: 41601
    
  55
The main method is called when you run the program from the command line like:

java -classpath ... fibonacci.FibonacciTester

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
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: 41601
    
  55
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 ]
anuja Edathu
Ranch Hand

Joined: Sep 09, 2005
Posts: 84
Thank you Ulf,
Anuja K.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Webservices