3-20 Getting Started With JAX-WS Web Services for Oracle WebLogic Server
supported, see JWS Annotation Reference in WebLogic Web Services Reference for Oracle WebLogic Server.
After you have updated the JWS file, Oracle recommends that you move it to an official source location, rather than leaving it in the wsdlc output directory.
The following example shows the wsdlc-generated JWS implementation file from the WSDL shown in
Section 2.3.1, Sample WSDL File ; the text in bold indicates where
you would add Java code to implement the single operation getTemp of the Web service:
package examples.webservices.wsdlc; import javax.jws.WebService;
TemperaturePortTypeImpl class implements web service endpoint interface TemperaturePortType
WebService serviceName=TemperatureService,
endpointInterface=examples.webservices.wsdlc.TemperaturePortType public class TemperaturePortTypeImpl implements TemperaturePortType {
public TemperaturePortTypeImpl { }
public float getTempjava.lang.String zipcode {
replace with your impl here return 0;
} }
3.9 Deploying and Undeploying WebLogic Web Services
Because Web services are packaged as Enterprise Applications, deploying a Web service simply means deploying the corresponding EAR file or exploded directory.
There are a variety of ways to deploy WebLogic applications, from using the Administration Console to using the weblogic.Deployer Java utility. There are also
various issues you must consider when deploying an application to a production environment as opposed to a development environment. For a complete discussion
about deployment, see Deploying Applications to Oracle WebLogic Server.
This guide, because of its development nature, discusses just two ways of deploying Web services:
■
Section 3.9.1, Using the wldeploy Ant Task to Deploy Web Services
■
Section 3.9.2, Using the Administration Console to Deploy Web Services
3.9.1 Using the wldeploy Ant Task to Deploy Web Services
The easiest way to deploy a Web service as part of the iterative development process is to add a target that executes the wldeploy WebLogic Ant task to the same
build.xml file that contains the jwsc Ant task. You can add tasks to both deploy and
undeploy the Web service so that as you add more Java code and regenerate the service, you can redeploy and test it iteratively.
To use the wldeploy Ant task, add the following target to your build.xml file: target name=deploy
wldeploy action=deploy name=DeploymentName
Developing WebLogic Web Services 3-21
source=Source user=AdminUser password=AdminPassword
adminurl=AdminServerURL targets=ServerName
target
where:
■
DeploymentName refers to the deployment name of the Enterprise Application, or the name that appears in the Administration Console under the list of
deployments.
■
Source refers to the name of the Enterprise Application EAR file or exploded directory that is being deployed. By default, the jwsc Ant task generates an
exploded Enterprise Application directory.
■
AdminUser refers to administrative username.
■
AdminPassword refers to the administrative password.
■
AdminServerURL refers to the URL of the Administration Server, typically t3:localhost:7001
.
■
ServerName refers to the name of the WebLogic Server instance to which you are deploying the Web service.
For example, the following wldeploy task specifies that the Enterprise Application exploded directory, located in the outputComplexServiceEar directory relative to
the current directory, be deployed to the myServer WebLogic Server instance. Its deployed name is ComplexServiceEar.
target name=deploy wldeploy action=deploy
name=ComplexServiceEar source=outputComplexServiceEar user=weblogic
password=weblogic verbose=true adminurl=t3:localhost:7001
targets=myserver target
To actually deploy the Web service, execute the deploy target at the command-line: prompt ant deploy
You can also add a target to easily undeploy the Web service so that you can make changes to its source code, then redeploy it:
target name=undeploy wldeploy action=undeploy
name=ComplexServiceEar user=weblogic
password=weblogic verbose=true adminurl=t3:localhost:7001
targets=myserver target
When undeploying a Web service, you do not specify the source attribute, but rather undeploy it by its name.
3-22 Getting Started With JAX-WS Web Services for Oracle WebLogic Server
3.9.2 Using the Administration Console to Deploy Web Services