Deploying Web Services in WebLogic Server 7.0

WebLogic Server 7.0 has a home page through which you can

  • View the WSDL describing the services.

  • Access and download the Web Service specific JAR file, which contains the interfaces, classes, and stubs required to invoke the Web Services.

  • View and test the XML for SOAP messages.

To deploy your Web Services application on WebLogic Server 7.0, follow these steps (these instructions are for an EJB Java application):

Note

To find debugging errors while invoking a WebLogic or non-WebLogic Web Service, turn the debugging option on while running the client applications by specifying the option

 java  Dweblogic.webservice.verbose =           true name_of_your_client_service) 

Debugging is discussed in detail in Day 19, "Using WebLogic Tools."


  1. Set up your environment by invoking the setEnv.cmd or setEnv.sh file, located in your domain directory.

  2. Get your EJB home, remote/local interfaces, and bean classes ready.

  3. If you are defining a non-built-in Java data type to be used in the EJB, get the non-built-in Java data type ready.

  4. Create your EJB deployment descriptors.

  5. Compile all of these classes.

  6. Copy the compiled class files into a directory and the deployment descriptors into a META-INF directory inside your staging directory. Then create the archived .jar file of the EJB.

  7. Create the build.xml (Ant build file) to execute the servicegen Ant task that will execute the WebLogic Web service. A sample Ant file for an EJB called myEJB is as follows:

     <project name="Web Services Example" default="build">    <target name="build" >     <delete dir="build_dir" />     <mkdir dir="build_dir" />     <copy todir="build_dir" file="myEJB.jar"/>     <servicegen       destEar="build_dir/myEJB.ear"       warName="myEJB.war"       contextURI="web_services">       <service          ejbJar="build_dir/myEJB.jar"          targetNamespace="... "          serviceName="myEJBService"          serviceURI="/myEJBService"          generateTypes="True"          expandMethods="True" >          <client              packageName="..."          />       </service>     </servicegen>   </target> <projects> 
  8. Create a staging directory for staging your Web Service application. Copy the EJB .jar file and the build.xml Ant file into this directory.

  9. Open a DOS prompt and go to this staging directory. Execute the Java Ant utility and create an archived ear file. To execute the Ant utility, type the command ant in the staging directory.

  10. Auto-deploy your ear file by pasting the ear file into the applications directory of your domain.

  11. Download the webservices.jar file from the BEA Web site. Put this into your classpath. You can now execute the Java Web service client and invoke methods of the EJB that you created earlier. A sample client application is as follows:

     import java.net.URL;  import javax.xml.rpc.ServiceFactory; import javax.xml.rpc.Service; import javax.xml.rpc.Call; import javax.xml.rpc.ParameterMode; public class WebServicesClient { public static void main(String[] args) throws Exception {   // Setting up global JAXM message factory     System.setProperty("javax.xml.soap.MessageFactory",       "weblogic.webservice.core.soap.MessageFactoryImpl");     // Setting up global JAX-RPC service factory     System.setProperty( "javax.xml.rpc.ServiceFactory",       "weblogic.webservice.core.rpc.ServiceFactoryImpl");     // Parse the argument list     WebServicesClient client = new WebServicesClient();     String wsdl = (args.length > 0? args[0] : null);     client.demonstrate(wsdl);   } public void demonstrate(String wsdlURI) throws Exception { //define your ejb port here. For eg, if your ejb name is //myEJB, and its service port is myEJBServicePort     myEJBServicePort myEJB = null;     if (wsdlURI == null) {       myEJB = new myEJBService().getMyEJBServicePort();     } else {       myEJB = new myEJBService(wsdlURI).getMyEJBServicePort();     }    /**define your variables and execute some methods of your ejb*/ ... ... ...  } } 

Limitations of WebLogic Server's Support for Web Services

The limitations of WebLogic Server's support for Web Services are as follows:

  • Due to limitations in SOAP, WebLogic does not support overloading operations in WSDL.

  • Use of data types other than the built-in ones is not supported, when they extend the following primitive date and XML Schema types: date, time, dateTime, duration, gMonth, gMonthDay, gDay, gYear, and gYearMonth.

  • Use of XML Schema list and simple union data types is not supported.

  • Use of XML Schema complex datatypes inheritance by restriction is not supported.



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net