• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to create a sample web service using jdk1.6 on JBoss server

 
Saurabh Saha
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm new in web services, I need to make a sample prototype web service using jdk1.6 on JBoss server.
I want to create simple web service that will show "Hello World"
for last three days I'm struggle to make a simple web service
Please help me, while searching on google I found some useful links as:

http://blogs.sun.com/dannycoward/date/20060227
http://ranganaths.wordpress.com/2006/10/04/web-services/

I tried but could not understand properly in the link

http://blogs.sun.com/dannycoward/date/20060227[/B]]http://blogs.sun.com/dannycoward/date/20060227

I found code as

javax.jws.WebService;

@WebService
public class NumberAdderUpperer {

public int addEmUp(int number1, int number2) {
return number1 + number2;
}

}

OK, so now you'd hit deploy in your IDE of course and stick it on the corporate app server, tell the world, and be done. But for the slightly more cautious amongst you, let's you and I do it with nothing more than the Mustang SDK, which has its own mini-Http server just for things like this:-

import javax.xml.ws.Endpoint;
...
Endpoint.publish("http://localhost:8080/ws-tmi/adderupperer", new NumberAdderUpperer ());

Oops ! And now your new number adding service is published at: "http://<hostname>:8080/ws-tmi/adderupperer".


I don't know how can I use this code in my sample web service.
Please help me.

Thanks & Regards,
Saurabh
 
Ranganath Junpal
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Developing a webservice on JDK1.6 is very easy.

1) Just write an normal java class,method, on top of the method use the annotation @webservice.

2) compile and deploy it in the server

3) Now it would have created a stubs for your service.
4) import the services as the library
5) call the method as you call from usual class

for ref you can contact me at http://iparams.com or Ref links :-
http://java.sun.com/webservices/docs/2.0/tutorial/doc/

-Ranganath
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!