Document 212994

http://josesaid.com 22-­‐Aug-­‐13 How to create a simple Java Web Service based on SOAP (JAX-WS) and
publish it on Netbeans 7.3
1. Create the Service Endpoint Interface
2. Create the implementer class for the SEI
Page 1 of 6
Created by José Said Olano García http://josesaid.com 22-­‐Aug-­‐13 3. Create the publisher of our Web Service.
4. Run our publisher class:
Page 2 of 6
Created by José Said Olano García http://josesaid.com 22-­‐Aug-­‐13 5. Now, we can go to this url: http://127.0.0.1:9876/ts and we could see the
link for the WSDL file:
6. Even, we also could browse into the WSDL in order to study it:
So far, we have built our web service and implement it. Let’s create a client in
order to test the result.
Page 3 of 6
Created by José Said Olano García http://josesaid.com 22-­‐Aug-­‐13 How to create a Java Client in order to consume a Web Service.
Now, we will be using the wsimport command.
1. We have to execute the command giving as parameters the location of our
destiny package and the WSDL file (url):
wsimport –p com.mx.josesaid.client –keep http://127.0.0.1:9876/ts?wsdl
2. Go to your prompt and execute it:
3. After executing the previous command, you will notice a result like this:
Page 4 of 6
Created by José Said Olano García http://josesaid.com 22-­‐Aug-­‐13 4. Now, you will see the new created files in the corresponding folder:
Page 5 of 6
Created by José Said Olano García http://josesaid.com 22-­‐Aug-­‐13 5. Finally, we just have to create the consumer of the Web Service:
6. We execute it, and ready, we have the result properly running.
Page 6 of 6
Created by José Said Olano García