Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Basic of a web service client

 
Jayavardhan geepi
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Example of a client with code and explanation is really helpful.

thanks
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Jayavardhan geepi
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic