8 Upgrading WebLogic Web Services From Previous Releases to 10.3.x

The following sections describe how to upgrade a pre-10.3.x WebLogic Server Web service to run in the Oracle WebLogic Server 11g Release 1 (10.3.x) Web service run-time environment:

Note:

8.1 and 9.2 WebLogic Web services will continue to run, without any changes, on version 10.3.x of WebLogic Server because the associated Web services run time is still supported in this release, although it is deprecated and will be removed from the product in future releases. For this reason, Oracle highly recommends that you follow the instructions in this chapter to upgrade your 8.1 or 9.2 Web service to 10.3.x.

In order for 8.1 Web services to run on version 10.3.x of WebLogic Server, you need to update the following system property:

System.setProperty('javax.xml.soap.SOAPFactory',
       'weblogic.webservice.core.soap.SOAPFactoryImpl');

To minimize the impact that this system property settings has on your 10.3.x Web service applications, it is recommended that you deploy the 8.1 Web services and clients on a server that is separate from the 10.3.x Web services and clients.

Upgrading a 9.2 or 10.0 WebLogic Web Service to 10.3.x

No steps are required to upgrade a 9.2 or 10.x WebLogic Web service to 10.3.x; you can redeploy the Web service to WebLogic Server 10.3.x without making any changes or recompiling.

Upgrading a 9.0 or 9.1 WebLogic Web Service to 10.3.x

If your 9.0/9.1 Web service used any of the following features, then you must recompile the Web service before you redeploy it to WebLogic Server 10.3.x:

  • Conversations

  • @weblogic.jws.Context JWS annotation

  • weblogic.wsee.jws.JwsContext API

To recompile, simply rerun the jwsc Ant task against the JWS file that implements your Web service.

If your 9.0/9.1 Web service did not use these features, then you can redeploy it to WebLogic Server 10.3.x without making any changes or recompiling it.

Upgrading an 8.1 WebLogic Web Service to 10.3.x

This section describes how to upgrade an 8.1 WebLogic Web service to use the new Version 10.3.x Web services run-time environment. The 10.3.x run time is based on the Web Services for Java EE 1.2 specification at http://www.jcp.org/en/jsr/detail?id=109. The 10.3.x programming model uses standard JDK 1.5 metadata annotations, as specified by the Web Services Metadata for the Java Platform specification (JSR-181) at http://www.jcp.org/en/jsr/detail?id=181.

Note:

8.1 WebLogic Web services will continue to run, without any changes, on 10.3.x of WebLogic Server because the 8.1 Web services run time is still supported in 10.3.x, although it is deprecated and will be removed from the product in future releases. For this reason, Oracle highly recommends that you follow the instructions in this chapter to upgrade your 8.1 Web service to 10.3.x.

Upgrading your 8.1 Web service includes the following high-level tasks; the procedures in later sections go into more detail:

  • Update the 8.1 Java source code of the Java class or stateless session EJB that implements the Web service so that the source code uses JWS annotations.

    In 10.3.x, WebLogic Web services are implemented using JWS files, which are Java files that contains JWS annotations. The jwsc Ant Task always implements the Web service as a plain Java file unless you explicitly implement javax.ejb.SessionBean in your JWS file. This latter case is not typical. This programming model differs from that of 8.1, where you were required to specify the type of back-end component (Java class or EJB).

  • Update the Ant build script that builds the Web service to call the 10.3.x WebLogic Web service Ant task jwsc instead of the 8.1 servicegen task.

In the sections that follow it is assumed that:

  • You previously used servicegen to generate your 8.1 Web service and that, more generally, you use Ant scripts in your development environment to iteratively develop Web services and other Java Platform, Enterprise Edition (Java EE) Version 5 artifacts that run on WebLogic Server. The procedures in this section direct you to update existing Ant build.xml files.

  • You have access to the Java class or EJB source code for your 8.1 Web service.

This section does not discuss the following topics:

  • Upgrading a JMS-implemented 8.1 Web service, because the 10.3.x WebLogic Web services run time does not support JMS-implemented services.

  • Upgrading Web services from versions previous to 8.1.

  • Upgrading a client application that invokes an 8.1 Web service to one that invokes a 10.3.x Web service. For details on how to write a client application that invokes a 10.3.x Web service, see Chapter 6, "Invoking Web Services."

Upgrading an 8.1 Java Class-Implemented WebLogic Web Service to 10.3.x: Main Steps

To upgrade an 8.1 Java class-implemented Web service to use the 10.3.x WebLogic Web services run time:

  1. Open a command window and set your WebLogic Server 10.3.x environment by executing the setDomainEnv.cmd (Windows) or setDomainEnv.sh (UNIX) script, located in the bin subdirectory of your 10.3.x domain directory.

    The default location of WebLogic Server domains is MW_HOME/user_projects/domains/domainName, where MW_HOME is the top-level installation directory of the Oracle products and domainName is the name of your domain.

  2. Create a project directory:

       prompt> mkdir /myExamples/upgrade_pojo
    
  3. Create a src directory under the project directory, as well as sub-directories that correspond to the package name of the new 10.3.x JWS file (shown later in this procedure) that corresponds to the old 8.1 Java class:

       prompt> cd /myExamples/upgrade_pojo
        prompt> mkdir src/examples/webservices/upgrade_pojo
    
  4. Copy the old Java class that implements the 8.1 Web service to the src/examples/webservices/upgrade_pojo directory of the working directory. Rename the file, if desired.

  5. Edit the Java file, as described in the following steps. See the old and new sample Java files in Example of an 8.1 Java File and the Corresponding 10.3.x JWS File for specific examples.

    1. If needed, change the package name and class name of the Java file to reflect the new 10.3.x source environment.

    2. Add import statements to import both the standard and WebLogic-specific JWS annotations.

    3. Add, at a minimum, the following JWS annotation:

      • The standard @WebService annotation at the Java class level to specify that the JWS file implements a Web service.

        Oracle recommends you also add the following annotations:

      • The standard @SOAPBinding annotation at the class-level to specify the type of Web service, such as document-literal-wrapped or RPC-encoded.

      • The WebLogic-specific @WLHttpTransport annotation at the class-level to specify the context and service URIs that are used in the URL that invokes the deployed Web service.

      • The standard @WebMethod annotation at the method-level for each method that is exposed as a Web service operation.

        See Chapter 4, "Programming the JWS File" for general information about using JWS annotations in a Java file.

    4. You might need to add additional annotations to your JWS file, depending on the 8.1 Web service features you want to carry forward to 10.3.x. In 8.1, many of these features were configured with attributes of servicegen. See Mapping of servicegen Attributes to JWS Annotations or jwsc Attributes for a table that lists equivalent JWS annotation, if available, for features you enabled in 8.1 using servicegen attributes.

  6. Copy the old build.xml file that built the 8.1 Web service to the 10.3.x working directory.

  7. Update your Ant build.xml file to execute the jwsc Ant task, along with other supporting tasks, instead of servicegen.

    Oracle recommends that you create a new target, such as build-service, in your Ant build file and add the jwsc Ant task call to compile the new JWS file you created in the preceding steps. Once this target is working correctly, you can remove the old servicegen Ant task.

    The following procedure lists the main steps to update your build.xml file; for details on the steps, see the standard iterative development process outlined in Chapter 3, "Developing WebLogic Web Services."

    See Example of an 8.1 and Updated 10.3.x Ant Build File for Java Class-Implemented Web Services for specific examples of the steps in the following procedure.

    1. Add the jwsc taskdef to the build.xml file.

    2. Create a build-service target and add the tasks needed to build the 10.3.x Web service, as described in the following steps.

    3. Add the jwsc task to the build file. Set the srdir attribute to the src directory (/myExamples/upgrade_pojo/src, in this example) and the destdir attribute to the root Enterprise application directory you created in the preceding step.

      Set the file attribute of the <jws> child element to the name of the new JWS file, created earlier in this procedure.

      You may need to specify additional attributes to the jwsc task, depending on the 8.1 Web service features you want to carry forward to 10.3.x. In 8.1, many of these features were configured using attributes of servicegen. See Mapping of servicegen Attributes to JWS Annotations or jwsc Attributes for a table that describes if there is an equivalent jwsc attribute for features you enabled using servicegen attributes.

  8. Execute the build-service Ant target. Assuming all the tasks complete successfully, the resulting Enterprise application contains your upgraded 10.3.x Web service.

See Deploying and Undeploying WebLogic Web Services and Browsing to the WSDL of the Web Service for additional information about deploying and testing your Web service.

Based on the sample Java code shown in the following sections, the URL to invoke the WSDL of the upgraded 10.3.x Web service is:

http://host:port/upgradePOJO/HelloWorld?WSDL

Example of an 8.1 Java File and the Corresponding 10.3.x JWS File

Assume that the following sample Java class implemented a 8.1 Web service:

package examples.javaclass;
/**
  * Simple Java class that implements the HelloWorld Web service.   It takes
  * as input an integer and a String, and returns a message that includes these
  * two parameters.
  */
public final class HelloWorld81 {
  /**
    * Returns a text message that includes the integer and String input
    * parameters.
    *
    */
   public String sayHello(int num, String s) {
    System.out.println("sayHello operation has been invoked with arguments " + s + " and " + num);
    String returnValue = "This message brought to you by the letter "+s+" and the number "+num;
    return returnValue;
   }
}

An equivalent JWS file for a 10.3.x Java class-implemented Web service is shown below, with the differences shown in bold. Note that some of the JWS annotation values are taken from attributes of the 8.1 servicegen Ant task shown in Example of an 8.1 and Updated 10.3.x Ant Build File for Java Class-Implemented Web Services.

package examples.webservices.upgrade_pojo;
// Import standard JWS annotations
import javax.jws.WebService;
 import javax.jws.WebMethod;
 import javax.jws.soap.SOAPBinding;
// Import WebLogic JWS anntoation
import weblogic.jws.WLHttpTransport;
/**
  * Simple Java class that implements the HelloWorld92 Web service.   It takes
  * as input an integer and a String, and returns a message that includes these
  * two parameters.
  */
@WebService(name="HelloWorld92PortType", serviceName="HelloWorld",
             targetNamespace="http://example.org")
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT,
              use=SOAPBinding.Use.LITERAL,
              parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
@WLHttpTransport(contextPath="upgradePOJO", serviceUri="HelloWorld",
                  portName="HelloWorld92Port")
public class HelloWorld92Impl {
  /**
    * Returns a text message that includes the integer and String input
    * parameters.
    *
    */
  @WebMethod()
   public String sayHello(int num, String s) {
    System.out.println("sayHello operation has been invoked with arguments " + s + " and " + num);
    String returnValue = "This message brought to you by the letter "+s+" and the number "+num;
    return returnValue;
   }
 }

Example of an 8.1 and Updated 10.3.x Ant Build File for Java Class-Implemented Web Services

The following simple build.xml file shows the 8.1 way to build a WebLogic Web service using the servicegen Ant task; in the example, the Java file that implements the 8.1 Web service has already been compiled into the examples.javaclass.HelloWorld81 class:

<project name="javaclass-webservice" default="all" basedir=".">
  <!-- set global properties for this build -->
   <property name="source" value="."/>
   <property name="build" value="${source}/build"/>
   <property name="war_file" value="HelloWorldWS.war" />
   <property name="ear_file" value="HelloWorldApp.ear" />
   <property name="namespace" value="http://examples.org" />
  <target name="all" depends="clean, ear"/>
  <target name="clean">
     <delete dir="${build}"/>
   </target>
  <!-- example of old 8.1 servicegen call to build Web Service -->
  <target name="ear">
     <servicegen
        destEar="${build}/${ear_file}"
        warName="${war_file}">
        <service
          javaClassComponents="examples.javaclass.HelloWorld81"
          targetNamespace="${namespace}"
          serviceName="HelloWorld"
          serviceURI="/HelloWorld"
          generateTypes="True"
          expandMethods="True">
        </service>
      </servicegen>
   </target>
</project>

An equivalent build.xml file that calls the jwsc Ant task to build a 10.3.x Web service is shown below, with the relevant tasks discussed in this section in bold. In the example, the new JWS file that implements the 10.3.x Web service is called HelloWorld92Impl.java:

<project name="webservices-upgrade_pojo" default="all">
  <!-- set global properties for this build -->
  <property name="wls.username" value="weblogic" />
   <property name="wls.password" value="weblogic" />
   <property name="wls.hostname" value="localhost" />
   <property name="wls.port" value="7001" />
   <property name="wls.server.name" value="myserver" />
  <property name="ear.deployed.name" value="upgradePOJOEar" />
   <property name="example-output" value="output" />
   <property name="ear-dir" value="${example-output}/upgradePOJOEar" />
  <taskdef name="jwsc"
     classname="weblogic.wsee.tools.anttasks.JwscTask" />
  <taskdef name="wldeploy"
     classname="weblogic.ant.taskdefs.management.WLDeploy"/>
  <target name="all" depends="clean,build-service,deploy" />
  <target name="clean" depends="undeploy">
     <delete dir="${example-output}"/>
   </target>
  <target name="build-service">
    <jwsc
       srcdir="src"
       destdir="${ear-dir}">
      <jws file="examples/webservices/upgrade_pojo/HelloWorld92Impl.java" />
    </jwsc>
  </target>
  <target name="deploy">
     <wldeploy action="deploy" name="${ear.deployed.name}"
       source="${ear-dir}" user="${wls.username}"
       password="${wls.password}" verbose="true"
       adminurl="t3://${wls.hostname}:${wls.port}"
       targets="${wls.server.name}" />
   </target>
  <target name="undeploy">
     <wldeploy action="undeploy" name="${ear.deployed.name}"
       failonerror="false"
       user="${wls.username}" password="${wls.password}" verbose="true"
       adminurl="t3://${wls.hostname}:${wls.port}"
       targets="${wls.server.name}" />
   </target>
</project>

Upgrading an 8.1 EJB-Implemented WebLogic Web Service to 10.3.x: Main Steps

The following procedure describes how to upgrade an 8.1 EJB-implemented Web service to use the 10.3.x WebLogic Web services run time.

The 10.3.x Web services programming model is quite different from the 8.1 model in that it hides the underlying implementation of the Web service. Rather than specifying up front that you want the Web service to be implemented by a Java class or an EJB, the jwsc Ant task always picks a plain Java class implementation, unless you have explicitly implemented javax.ejb.SessionBean in the JWS file, which is not typical. For this reason, the following procedure does not show how to import EJB classes or use EJBGen, even though the 8.1 Web service was explicitly implemented with an EJB. Instead, the procedure shows how to create a standard JWS file that is the 10.3.x equivalent to the 8.1 EJB-implemented Web service.

  1. Open a command window and set your 10.3.xWebLogic Server environment by executing the setDomainEnv.cmd (Windows) or setDomainEnv.sh (UNIX) script, located in the bin subdirectory of your 10.3.x domain directory.

    The default location of WebLogic Server domains is MW_HOME/user_projects/domains/domainName, where MW_HOME is the top-level installation directory of the Oracle products and domainName is the name of your domain.

  2. Create a project directory:

       prompt> mkdir /myExamples/upgrade_ejb
    
  3. Create a src directory under the project directory, as well as sub-directories that correspond to the package name of the new 10.3.x JWS file (shown later on in this procedure) that corresponds to your 8.1 EJB implementation:

       prompt> cd /myExamples/upgrade_ejb
        prompt> mkdir src/examples/webservices/upgrade_ejb
    
  4. Copy the 8.1 EJB Bean file that implemented javax.ejb.SessionBean to the src/examples/webservices/upgrade_ejb directory of the working directory. Rename the file, if desired.

    Note:

    You do not need to copy over the 8.1 Home and Remote EJB files.
  5. Edit the EJB Bean file, as described in the following steps. See the old and new sample Java files in Example of 8.1 EJB Files and the Corresponding 10.3.x JWS File for specific examples.

    1. If needed, change the package name and class name of the Java file to reflect the new 10.3.x source environment.

    2. Optionally remove the import statements that import the EJB classes (javax.ejb.*). These classes are no longer needed in the upgraded JWS file.

    3. Add import statements to import both the standard and WebLogic-specific JWS annotations.

    4. Ensure that the JWS file does not implement javax.ejb.SessionBean anymore by removing the implements SessionBean code from the class declaration.

    5. Remove all the EJB-specific methods:

      • ejbActivate()

      • ejbRemove()

      • ejbPassivate()

      • ejbCreate()

    6. Add, at a minimum, the following JWS annotation:

      • The standard @WebService annotation at the Java class level to specify that the JWS file implements a Web service.

        Oracle recommends you also add the following annotations:

      • The standard @SOAPBinding annotation at the class-level to specify the type of Web service, such as document-literal-wrapped or RPC-encoded.

      • The WebLogic-specific @WLHttpTransport annotation at the class-level to specify the context and service URIs that are used in the URL that invokes the deployed Web service.

      • The standard @WebMethod annotation at the method-level for each method that is exposed as a Web service operation.

      See Chapter 4, "Programming the JWS File" for general information about using JWS annotations in a Java file.

    7. You might need to add additional annotations to your JWS file, depending on the 8.1 Web service features you want to carry forward to 10.3.x. In 8.1, many of these features were configured using attributes of servicegen. See Mapping of servicegen Attributes to JWS Annotations or jwsc Attributes for a table that lists equivalent JWS annotation, if available, for features you enabled in 8.1 using servicegen attributes.

  6. Copy the old build.xml file that built the 8.1 Web service to the 10.3.x working directory.

  7. Update your Ant build.xml file to execute the jwsc Ant task, along with other supporting tasks, instead of servicegen.

    Oracle recommends that you create a new target, such as build-service, in your Ant build file and add the jwsc Ant task call to compile the new JWS file you created in the preceding steps. Once this target is working correctly, you can remove the old servicegen Ant task.

    The following procedure lists the main steps to update your build.xml file; for details on the steps, see the standard iterative development process outlined in

    See Example of an 8.1 and Updated 10.3.x Ant Build File for an 8.1 EJB-Implemented Web Service for specific examples of the steps in the following procedure.

    1. Add the jwsc taskdef to the build.xml file.

    2. Create a build-service target and add the tasks needed to build the 10.3.x Web service, as described in the following steps.

    3. Add the jwsc task to the build file. Set the srdir attribute to the src directory (/myExamples/upgrade_ejb/src, in this example) and the destdir attribute to the root Enterprise application directory you created in the preceding step.

      Set the file attribute of the <jws> child element to the name of the new JWS file, created earlier in this procedure.

      You may need to specify additional attributes to the jwsc task, depending on the 8.1 Web service features you want to carry forward to 10.3.x. In 8.1, many of these features were configured using attributes of servicegen. See Mapping of servicegen Attributes to JWS Annotations or jwsc Attributes for a table that indicates whether there is an equivalent jwsc attribute for features you enabled using servicegen attributes.

  8. Execute the build-service Ant target. Assuming all tasks complete successfully, the resulting Enterprise application contains your upgraded 10.3.x Web service.

See Deploying and Undeploying WebLogic Web Services and Browsing to the WSDL of the Web Service for additional information about deploying and testing your Web service.

Based on the sample Java code shown in the following sections, the URL to invoke the WSDL of the upgraded 10.3.x Web service is:

http://host:port/upgradeEJB/HelloWorldService?WSDL

Example of 8.1 EJB Files and the Corresponding 10.3.x JWS File

Assume that the Bean, Home, and Remote classes and interfaces, shown in the next three sections, implemented the 8.1 stateless session EJB which in turn implemented an 8.1 Web service.

The equivalent 10.3.x JWS file is shown in Equivalent 10.3.x JWS File. The differences between the 8.1 and 10.3.x classes are shown in bold. Note that some of the JWS annotation values are taken from attributes of the 8.1 servicegen Ant task shown in Example of an 8.1 and Updated 10.3.x Ant Build File for an 8.1 EJB-Implemented Web Service.

8.1 SessionBean Class
package examples.statelessSession;
import javax.ejb.CreateException;
 import javax.ejb.SessionBean;
 import javax.ejb.SessionContext;
/**
  * HelloWorldBean is a stateless session EJB.  It has a single method,
  * sayHello(), that takes an integer and a String and returns a String.
  * <p>
  * The sayHello() method is the public operation of the Web service based on
  * this EJB.
   */
public class HelloWorldBean81 implements SessionBean {
  private static final boolean VERBOSE = true;
   private SessionContext ctx;
  // You might also consider using WebLogic's log service
   private void log(String s) {
     if (VERBOSE) System.out.println(s);
   }
  /**
    *   Single EJB business method.
    */
   public String sayHello(int num, String s) {
    System.out.println("sayHello in the HelloWorld EJB has "+
       "been invoked with arguments " + s + " and " + num);
    String returnValue = "This message brought to you by the "+
       "letter "+s+" and the number "+num;
    return returnValue;
   }
  /**
    * This method is required by the EJB Specification,
    * but is not used by this example.
    *
    */
   public void ejbActivate() {
     log("ejbActivate called");
   }
  /**
    * This method is required by the EJB Specification,
    * but is not used by this example.
    *
    */
   public void ejbRemove() {
     log("ejbRemove called");
   }
  /**
    * This method is required by the EJB Specification,
    * but is not used by this example.
    *
    */
   public void ejbPassivate() {
     log("ejbPassivate called");
   }
  /**
    * Sets the session context.
    *
    * @param ctx SessionContext Context for session
    */
   public void setSessionContext(SessionContext ctx) {
     log("setSessionContext called");
     this.ctx = ctx;
   }
  /**
    * This method is required by the EJB Specification,
    * but is not used by this example.
    *
    */
   public void ejbCreate () throws CreateException {
     log("ejbCreate called");
   }
}
8.1 Remote Interface
package examples.statelessSession;
import java.rmi.RemoteException;
 import javax.ejb.EJBObject;
/**
  * The methods in this interface are the public face of HelloWorld.
  * The signatures of the methods are identical to those of the EJBean, except
  * that these methods throw a java.rmi.RemoteException.
   */
public interface HelloWorld81 extends EJBObject {
  /**
    * Simply says hello from the EJB
    *
    * @param num               int number to return
    * @param s                 String string to return
    * @return                  String returnValue
    * @exception               RemoteException if there is
    *                          a communications or systems failure
    */
   String sayHello(int num, String s)
     throws RemoteException;
 }
8.1 EJB Home Interface
package examples.statelessSession;
import java.rmi.RemoteException;
 import javax.ejb.CreateException;
 import javax.ejb.EJBHome;
/**
  * This interface is the Home interface of the HelloWorld stateless session EJB.
  */
 public interface HelloWorldHome81 extends EJBHome {
  /**
    * This method corresponds to the ejbCreate method in the
    * HelloWorldBean81.java file.
    */
   HelloWorld81 create()
     throws CreateException, RemoteException;
}
Equivalent 10.3.x JWS File

The differences between the 8.1 and 10.3.x files are shown in bold. The value of some JWS annotations are taken from attributes of the 8.1 servicegen Ant task shown in Example of an 8.1 and Updated 10.3.x Ant Build File for an 8.1 EJB-Implemented Web Service.

package examples.webservices.upgrade_ejb;
// Import the standard JWS annotations
import javax.jws.WebMethod;
 import javax.jws.WebService;
 import javax.jws.soap.SOAPBinding;
// Import the WebLogic specific annotation
import weblogic.jws.WLHttpTransport;
// Class-level annotations
@WebService(name="HelloWorld92PortType", serviceName="HelloWorldService",
             targetNamespace="http://example.org")
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT,
              use=SOAPBinding.Use.LITERAL,
              parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
@WLHttpTransport(contextPath="upgradeEJB", serviceUri="HelloWorldService",
                  portName="HelloWorld92Port")
/**
  * HelloWorld92Impl is the JWS equivalent of the HelloWorld81 EJB that
  * implemented the 8.1 Web Service.  It has a single method,
  * sayHello(), that takes an integer and a String and returns a String.
  */
public class HelloWorld92Impl {
  /** the sayHello method will become the public operation of the Web
    *  Service.
    */
  @WebMethod()
   public String sayHello(int num, String s) {
    System.out.println("sayHello in the HelloWorld92 Web Service has "+
       "been invoked with arguments " + s + " and " + num);
    String returnValue = "This message brought to you by the "+
       "letter "+s+" and the number "+num;
    return returnValue;
  }
}

Example of an 8.1 and Updated 10.3.x Ant Build File for an 8.1 EJB-Implemented Web Service

The following simple build.xml file shows the 8.1 way to build an EJB-implemented WebLogic Web service using the servicegen Ant task. Following this example is an equivalent build.xml file that calls the jwsc Ant task to build a 10.3.x Web service.

<project name="ejb-webservice" default="all" basedir=".">
  <!-- set global properties for this build -->
   <property name="source" value="."/>
   <property name="build" value="${source}/build"/>
   <property name="ejb_file" value="HelloWorldWS.jar" />
   <property name="war_file" value="HelloWorldWS.war" />
   <property name="ear_file" value="HelloWorldApp.ear" />
   <property name="namespace" value="http://examples.org" />
  <target name="all" depends="clean,ear"/>
  <target name="clean">
     <delete dir="${build}"/>
   </target>
  <!-- example of old 8.1 servicegen call to build Web Service -->
  <target name="ejb">
     <delete dir="${build}" />
     <mkdir dir="${build}"/>
     <mkdir dir="${build}/META-INF"/>
     <copy todir="${build}/META-INF">
       <fileset dir="${source}">
         <include name="ejb-jar.xml"/>
       </fileset>
     </copy>
     <javac srcdir="${source}" includes="HelloWorld*.java" 
            destdir="${build}" />
     <jar jarfile="${ejb_file}" basedir="${build}" />
     <wlappc source="${ejb_file}" />
   </target>
 <target name="ear" depends="ejb">
    <servicegen
       destEar="${build}/${ear_file}"
       warName="${war_file}">
       <service
         ejbJar="${ejb_file}"
         targetNamespace="${namespace}"
         serviceName="HelloWorldService"
         serviceURI="/HelloWorldService"
         generateTypes="True"
         expandMethods="True">
       </service>
     </servicegen>
  </target>
</project>

An equivalent build.xml file that calls the jwsc Ant task to build a 10.3.x Web service is shown below, with the relevant tasks discussed in this section in bold:

<project name="webservices-upgrade_ejb" default="all">
  <!-- set global properties for this build -->
  <property name="wls.username" value="weblogic" />
   <property name="wls.password" value="weblogic" />
   <property name="wls.hostname" value="localhost" />
   <property name="wls.port" value="7001" />
   <property name="wls.server.name" value="myserver" />
  <property name="ear.deployed.name" value="upgradeEJB" />
   <property name="example-output" value="output" />
   <property name="ear-dir" value="${example-output}/upgradeEJB" />
  <taskdef name="jwsc"
     classname="weblogic.wsee.tools.anttasks.JwscTask" />
  <taskdef name="wldeploy"
     classname="weblogic.ant.taskdefs.management.WLDeploy"/>
  <target name="all" depends="clean,build-service,deploy" />
  <target name="clean" depends="undeploy">
     <delete dir="${example-output}"/>
   </target>
  <target name="build-service">
    <jwsc
       srcdir="src"
       destdir="${ear-dir}">
      <jws file="examples/webservices/upgrade_ejb/HelloWorld92Impl.java" />
    </jwsc>
  </target>
  <target name="deploy">
     <wldeploy action="deploy" name="${ear.deployed.name}"
       source="${ear-dir}" user="${wls.username}"
       password="${wls.password}" verbose="true"
       adminurl="t3://${wls.hostname}:${wls.port}"
       targets="${wls.server.name}" />
   </target>
  <target name="undeploy">
     <wldeploy action="undeploy" name="${ear.deployed.name}"
       failonerror="false"
       user="${wls.username}" password="${wls.password}" verbose="true"
       adminurl="t3://${wls.hostname}:${wls.port}"
       targets="${wls.server.name}" />
   </target>
</project>

Mapping of servicegen Attributes to JWS Annotations or jwsc Attributes

The following table maps the attributes of the 8.1 servicegen Ant task to their equivalent 10.3.x JWS annotation or jwsc attribute.

The attributes listed in the first column are a mixture of attributes of the main servicegen Ant task and attributes of the four child elements of servicegen (<service>, <client>, <handlerChain>, and <security>)

See "JWS Annotation Reference" and "jwsc" in the Oracle Fusion Middleware WebLogic Web Services Reference for Oracle WebLogic Server for more information about the 10.3.x JWS annotations and jwsc Ant task.

Table 8-1 Mapping of servicegen Attributes to JWS Annotations or jwsc Attributes

servicegen or Child Element of servicegen Attribute Equivalent JWS Annotation or jwsc Attribute

contextURI

contextPath attribute of the WebLogic-specific @WLHttpTransport annotation.

Note: Because this is a WebLogic-specific annotation, you can use it to generate only a JAX-RPC Web service, and not a JAX-WS Web service.

destEAR

destdir attribute of the jwsc Ant task.

keepGenerated

keepGenerated attribute of the jwsc Ant task.

mergeWithExistingWS

No equivalent.

overwrite

No equivalent.

warName

name attribute of the <jws> child element of the jwsc Ant task.

ejbJAR

(attribute of the service child element)

No direct equivalent, because the jwsc Ant task generates Web service artifacts from a JWS file, rather than a compiled EJB or Java class.

Indirect equivalent is the file attribute of the <jws> child element of the jwsc Ant task that specifies the name of the JWS file.

excludeEJBs

(attribute of the service child element)

No equivalent.

expandMethods

(attribute of the service child element)

No equivalent.

generateTypes

(attribute of the service child element)

No equivalent.

ignoreAuthHeader

(attribute of the service child element)

No equivalent.

includeEJBs

(attribute of the service child element)

No equivalent.

javaClassComponents

(attribute of the service child element)

No direct equivalent, because the jwsc Ant task generates Web service artifacts from a JWS file, rather than a compiled EJB or Java class.

Indirect equivalent is the file attribute of the <jws> child element of the jwsc Ant task that specifies the name of the JWS file.

JMSAction

(attribute of the service child element)

No equivalent because JMS-implemented Web services are not supported in the 10.3.x release.

JMSConnectionFactory

(attribute of the service child element)

No equivalent because JMS-implemented Web services are not supported in the 10.3.x release.

JMSDestination

(attribute of the service child element)

No equivalent because JMS-implemented Web services are not supported in the 10.3.x release.

JMSDestinationType

(attribute of the service child element)

No equivalent because JMS-implemented Web services are not supported in the 10.3.x release.

JMSMessageType

(attribute of the service child element)

No equivalent because JMS-implemented Web services are not supported in the 10.3.x release.

JMSOperationName

(attribute of the service child element)

No equivalent because JMS-implemented Web services are not supported in the 10.3.x release.

protocol

(attribute of the service child element)

One of the following WebLogic-specific annotations:

  • @WLHttpTransport

  • @WLJmsTransport

Note: Because these are WebLogic-specific annotations, you can use them to generate only a JAX-RPC Web service, and not a JAX-WS Web service.

serviceName

(attribute of the service child element)

serviceName attribute of the standard @WebService annotation.

serviceURI

(attribute of the service child element)

serviceUri attribute of the WebLogic-specific @WLHttpTransport or @WLJmsTransport annotations.

Note: Because these are WebLogic-specific annotations, you can use them to generate only a JAX-RPC Web service, and not a JAX-WS Web service.

style

(attribute of service child element)

style attribute of the standard @SOAPBinding annotation.

typeMappingFile

(attribute of the service child element)

No equivalent.

targetNamespace

(attribute of the service child element)

targetNamespace attribute of the standard @WebService annotation.

userSOAP12

(attribute of the service child element)

value attribute of the WebLogic-specific @weblogic.jws.Binding JWS annotation

Note: Because this is a WebLogic-specific annotation, you can use it to generate only a JAX-RPC Web service, and not a JAX-WS Web service.

clientJarName

(attribute of client child element)

No equivalent.

packageName

(attribute of the client child element)

No direct equivalent.

Use the packageName attribute of the clientgen Ant task to generate client-side Java code and artifacts.

saveWSDL

(attribute of the client child element)

No equivalent.

userServerTypes

(attribute of the client child element)

No equivalent.

handlers

(attribute of the handlerChain child element)

Standard @HandlerChain or @SOAPMessageHandlers annotation.

name

(attribute of the handlerChain child element)

Standard @HandlerChain or @SOAPMessageHandlers annotation.

duplicateElimination

(attribute of the reliability child element)

No direct equivalent.

Use WebLogic-specific @Policy attribute to specify a WS-Policy file that contains Web service reliable messaging policy assertions.

See "Using Web Service Reliable Messaging" in Oracle Fusion Middleware Programming Advanced Features of JAX-RPC Web Services for Oracle WebLogic Server.

persistDuration

(attribute of the reliability child element)

No direct equivalent.

Use WebLogic-specific @Policy attribute to specify a WS-Policy file that contains Web service reliable messaging policy assertions.

In this release, the equivalent is valid for JAX-RPC Web services only. See "Using Web Service Reliable Messaging" in Oracle Fusion Middleware Programming Advanced Features of JAX-RPC Web Services for Oracle WebLogic Server.

enablePasswordAuth

(attribute of the security child element)

No direct equivalent.

Use WebLogic-specific @Policy attribute to specify a WS-Policy file that contains message-level security policy assertions.

Note: Because this is a WebLogic-specific annotation, you can use it to generate only a JAX-RPC Web service, and not a JAX-WS Web service.

See "Configuring Message-Level Security" in Oracle Fusion Middleware Securing WebLogic Web Services for Oracle WebLogic Server.

encryptKeyName

(attribute of the security child element)

No direct equivalent.

Use WebLogic-specific @Policy attribute to specify a WS-Policy file that contains message-level security policy assertions.

Note: Because this is a WebLogic-specific annotation, you can use it to generate only a JAX-RPC Web service, and not a JAX-WS Web service.

See "Configuring Message-Level Security" in Oracle Fusion Middleware Securing WebLogic Web Services for Oracle WebLogic Server.

encryptKeyPass

(attribute of the security child element)

No direct equivalent.

Use WebLogic-specific @Policy attribute to specify a WS-Policy file that contains message-level security policy assertions.

Note: Because this is a WebLogic-specific annotation, you can use it to generate only a JAX-RPC Web service, and not a JAX-WS Web service.

See "Configuring Message-Level Security" in Oracle Fusion Middleware Securing WebLogic Web Services for Oracle WebLogic Server.

password

(attribute of the security child element)

No direct equivalent.

Use WebLogic-specific @Policy attribute to specify a WS-Policy file that contains message-level security policy assertions.

See "Configuring Message-Level Security" in Oracle Fusion Middleware Securing WebLogic Web Services for Oracle WebLogic Server.

signKeyName

(attribute of the security child element)

No direct equivalent.

Use WebLogic-specific @Policy attribute to specify a WS-Policy file that contains message-level security policy assertions.

Note: Because this is a WebLogic-specific annotation, you can use it to generate only a JAX-RPC Web service, and not a JAX-WS Web service.

See "Configuring Message-Level Security" in Oracle Fusion Middleware Securing WebLogic Web Services for Oracle WebLogic Server.

signKeyPass

(attribute of the security child element)

No direct equivalent.

Use WebLogic-specific @Policy attribute to specify a WS-Policy file that contains message-level security policy assertions.

Note: Because this is a WebLogic-specific annotation, you can use it to generate only a JAX-RPC Web service, and not a JAX-WS Web service.

See "Configuring Message-Level Security" in Oracle Fusion Middleware Securing WebLogic Web Services for Oracle WebLogic Server.

username

(attribute of the security child element)

No direct equivalent.

Use WebLogic-specific @Policy attribute to specify a WS-Policy file that contains message-level security policy assertions.

Note: Because this is a WebLogic-specific annotation, you can use it to generate only a JAX-RPC Web service, and not a JAX-WS Web service.

See "Configuring Message-Level Security" in Oracle Fusion Middleware Securing WebLogic Web Services for Oracle WebLogic Server.