2. Using the Tutorial Examples 3. Getting Started with Web Applications 5. JavaServer Pages Technology 7. JavaServer Pages Standard Tag Library 10. JavaServer Faces Technology 11. Using JavaServer Faces Technology in JSP Pages 12. Developing with JavaServer Faces Technology 13. Creating Custom UI Components 14. Configuring JavaServer Faces Applications 15. Internationalizing and Localizing Web Applications 16. Building Web Services with JAX-WS 17. Binding between XML Schema and Java Classes 19. SOAP with Attachments API for Java 21. Getting Started with Enterprise Beans Building, Packaging, Deploying, and Running thecart Example Building, Packaging, and Deploying thecart Example Using NetBeans IDE Running thecart Application Client Using NetBeans IDE Building, Packaging, and Deploying thecart Example Using Ant Running thecart Application Client Using Ant A Web Service Example:helloservice The Web Service Endpoint Implementation Class Stateless Session Bean Implementation Class Building, Packaging, Deploying, and Testing thehelloservice Example Building, Packaging, and Deploying thehelloservice Example Using NetBeans IDE Building, Packaging, and Deploying thehelloservice Example Using Ant Building, Packaging, Deploying, and Running thetimersession Example Building, Packaging, Deploying, and Running thetimersession Example Using NetBeans IDE Building, Packaging, and Deploying thetimersession Example Using Ant Running thetimersession Application Client Using Ant 23. A Message-Driven Bean Example 24. Introduction to the Java Persistence API 25. Persistence in the Web Tier 26. Persistence in the EJB Tier 27. The Java Persistence Query Language 28. Introduction to Security in the Java EE Platform 29. Securing Java EE Applications 31. The Java Message Service API 32. Java EE Examples Using the JMS API 36. The Coffee Break Application | A Web Service Example:helloserviceThis example demonstrates a simple web service that generates a response based oninformation received from the client.HelloServiceBean is a stateless session bean thatimplements a single method,sayHello. This method matches thesayHello method invoked bythe client described inA Simple JAX-WS Client. The Web Service Endpoint Implementation ClassHelloServiceBean is the endpoint implementation class. The endpoint implementation class is typically the primaryprogramming artifact for enterprise bean web service endpoints. The web service endpoint implementationclass has the following requirements:
Stateless Session Bean Implementation ClassTheHelloServiceBean class implements thesayHello method, which is annotated@WebMethod. The sourcecode for theHelloServiceBean class follows: package com.sun.tutorial.javaee.ejb;import javax.ejb.Stateless;import javax.jws.WebMethod;import javax.jws.WebService;@Stateless@WebServicepublic class HelloServiceBean { private String message = "Hello, "; public void HelloServiceBean() {} @WebMethod public String sayHello(String name) { return message + name + "."; }}Building, Packaging, Deploying, and Testing thehelloservice ExampleYou can build, package, and deploy thehelloservice example using either NetBeans IDEor Ant. You can then use the Admin Console to test the webservice endpoint methods. Building, Packaging, and Deploying thehelloservice Example Using NetBeans IDEFollow these instructions to build, package, and deploy thehelloservice example toyour Application Server instance using NetBeans IDE.
This builds and packages to application intohelloservice.ear, located intut-install/javaeetutorial5/examples/ejb/helloservice/dist, and deploys thisear file to your Application Server instance. Building, Packaging, and Deploying thehelloservice Example Using AntFollow these instructions to build, package, and deploy thehelloservice example toyour Application Server instance using Ant.
Testing the Service without a ClientThe Application Server Admin Console allows you to test the methods ofa web service endpoint. To test thesayHello method ofHelloServiceBean, do thefollowing:
Copyright © 2010, Oracle and/or its affiliates. All rights reserved.Legal Notices |