|
WebLogic Server 7.0 Code Examples, BEA Systems, Inc. | |||||
HelloWorld that uses only built-in data types
as its input parameters and return value.
See:
Description
| Interface Summary | |
| HelloWorld | The methods in this interface are the public face of HelloWorld. |
| HelloWorldHome | This interface is the Home interface of the HelloWorld stateless session EJB. |
| Class Summary | |
| Client | This class illustrates how to use the JAX-RPC API to statically invoke the HelloWorldEJB WebLogic Web service. |
| HelloWorldBean | HelloWorldBean is a stateless session EJB. |
This example shows how to create a WebLogic Web service based on a stateless
session EJB called HelloWorld that uses only built-in data types
as its input parameters and return value.
The HelloWorld EJB defines a single method, sayHello(),
that takes as input an int and a String parameter
and returns a String message built from the two inputted parameters.
When this EJB is converted into a Web service, the sayHello method
becomes the public operation defined in the WSDL of the Web service.
The build.xml file compiles, assembles, packages, deploys,
and runs the example. The file calls the servicegen Ant task that
automatically generates the following components:
web-services.xml,
that describes how to deploy the Web service on WebLogic Server
servicegen generates all these components, it packages them,
along with the EJB JAR file, into an EAR file that can be deployed on WebLogic
Server.
The build.xml file then calls the clientgen Ant task
that creates another client JAR file used by a client application to invoke the
Web service. This client JAR file is created locally rather than the one that's
created as part of the servicegen Ant task that ends up on WebLogic
Server. Typically users that need the client JAR file either use the
clientgen Ant task or download it from the Web services Home Page.
Client.java is a static client application that directly uses the
Web service interfaces to invoke the sayHello operation. It uses
JAX-RPC style APIs to invoke the Web service.
| Additional Resources for examples.webservices.basic.statelessSession | |
| ejb-jar.xml | The J2EE EJB deployment descriptor file that describes the HelloWorld stateless session EJB. |
| build.xml | The Java Ant build script that creates an EJB JAR file that contains the HelloWorld EJB, creates the Web service EAR file using the servicegen Ant task, creates the client JAR file using the clientgen Ant task, compiles the client application, deploys the EAR file, and runs the application. |
The following sections describe how to build and run the example.
Before you run this example, you need:
prompt> ant
prompt> ant run
http://localhost:port/basic_statelessSession/HelloWorldEJB
where
From the Web Service Home Page you can view the generated WSDL, and test the Web service to make sure it's working correctly.
setSessionContext called ejbCreate called sayHello in the HelloWorld EJB has been invoked with arguments A and 4And the following output in your client window:
Buildfile: build.xml
run:
[java] The client passed the Values 4 and A to the webservice, and got back
this result:
[java] This message brought to you by the letter A and the number 4
BUILD SUCCESSFUL
|
Documentation is available at http://e-docs.bea.com/wls/docs70 |
|||||