|
WebLogic Server 7.0 Code Examples, BEA Systems, Inc. | |||||
See:
Description
| Class Summary | |
| Client | This class illustrates how to use the JAX-RPC API to statically invoke the HelloWorld WebLogic Web Service, implemented with a Java class. |
| HelloWorld | Simple Java class that implements the HelloWorld Web service. |
This example shows how to create a WebLogic Web service based on a custom Java class backend component.
The Java class is a classic HelloWorld program that defines a single method
called sayHello. The method takes only built-in data types as its
parameters and return value. In particular, the sayHello method
takes as input an int and a String parameter and returns
a String return value.
When the Java class is converted into a Web service, the sayHello
method becomes the public operation specified in the WSDL of the Web service.
The build.xml file compiles, assembles, packages, deploys, and
runs the example. The file calls the servicegen WebLogic Ant task
that automatically generates:
web-services.xml, that describes how to deploy the Web service on WebLogic Server
After servicegen generates these components, it packages them, along
with the Java class, 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.javaclass | |
| build.xml | The Java Ant build script that creates the Java class JAR file, 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_javaclass/HelloWorld
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.
sayHello in webservices.basic.javaclass webservice 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 |
|||||