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 Basic of a web service client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Basic of a web service client" Watch "Basic of a web service client" New topic
Author

Basic of a web service client

Jayavardhan geepi
Ranch Hand

Joined: Jul 21, 2010
Posts: 66
Hi,
I'm a novice to web services. I searched a lot for it in internet and It wasn't helpful. So I'm posting it here hoping for replies.

I've written a web service. While writing client to test that, I came to know that , first step is to generate stubs using wsimport tool which takes a URL.

My question is what that URL points to .? http://localhost:8080/myApp/myWebService?wsdl.

How to deploy a web service ? I know concepts but, unable to execute those in programs.
Can someone please help me. Appreciate the detailed answer.

Thanks and Regards,
jayavardhan
Jayavardhan geepi
Ranch Hand

Joined: Jul 21, 2010
Posts: 66
Example of a client with code and explanation is really helpful.

thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
What toolkit did you use for creating this web service?

The ones I am familiar with always come with worked out examples of client code.

Bill
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
There are quite a few web service tutorials available here: http://netbeans.org/kb/trails/web.html
Both for web service and web service client development.
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Jayavardhan geepi
Ranch Hand

Joined: Jul 21, 2010
Posts: 66
Hi.. Thanks for reply.

I'm using eclipse for this with tomcat server and client in jboss.

I got 2 questions here.
In the wsdlLocation - like "http://localhost:8070/MyApp/HelloService?wsdl " , the /HelloService is mapped to some apache axis servlet. What is that? This mapping is generated by eclipse itself.


I'm able to view wsdl file with the above mentioned url.
I have generated proxy using wsimport.

I have written one more web app(client) to test the service. In that I have a servlet with goGet() method. Also I have given @WebServiceRef(wsdlLocation="http://localhost:8070/MyApp/HelloService?wsdl").

But I got null pointer exception while testing. i.e the service annotated with @WebServiceRef was null.

I'm more interested in knowing about the servlet that was mapped to '/HelloService'.



Thanks and Regards,
J

Alpha Omega
Greenhorn

Joined: Jan 09, 2011
Posts: 7
If i were you, I would just use JAX-WS RI (Reference Implementation) which comes in built with JDK 6.

Below is some sample code from Java Webservices: Up and running book

----------- Service Endpoint Interface ---------


---- Service Implementation Bean -------------


------ Web service Publisher------------



Compile this src & run TimeServerPublisher

Open a browser & key in http://localhost:9876/ts?wsdl and there you go..

That's your first web service built and published.

You can build the client from this wsdl & invoke it like you do for any other web service.


P.S. I know i have skipped tons of details but i would suggest you to go thru Java Web Services: Up and Running book and read it thru.

This is what i am doing even tho i have some experience in building JAX-RPC based web services.

Cheers,
AA

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic of a web service client