http://josesaid.com 22Aug13 Page 1 of 6 Created by José Said Olano García 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
6
Embed
How to create_a_simple_java_web_service_and_publish_it_on_netbeans_7
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
http://josesaid.com 22-‐Aug-‐13
Page 1 of 6 Created by José Said Olano García
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
http://josesaid.com 22-‐Aug-‐13
Page 2 of 6 Created by José Said Olano García
3. Create the publisher of our Web Service.
4. Run our publisher class:
http://josesaid.com 22-‐Aug-‐13
Page 3 of 6 Created by José Said Olano García
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.
http://josesaid.com 22-‐Aug-‐13
Page 4 of 6 Created by José Said Olano García
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:
http://josesaid.com 22-‐Aug-‐13
Page 5 of 6 Created by José Said Olano García
4. Now, you will see the new created files in the corresponding folder:
http://josesaid.com 22-‐Aug-‐13
Page 6 of 6 Created by José Said Olano García
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.