Configure the webservicesclient.xml deployment descriptor

After you generate the webservicesclient.xml file, you may want to edit some of the values in the file. If the default values that the WSDL2Java generates are acceptable, you do not need to change any of them.

To configure the webservicesclient.xml deployment descriptor, follow these steps:

  1. Open the webservicesclient.xml deployment descriptor in a text editor.

  2. For the <description> element in the <service-ref> element, specify a descriptive name for the service that the client accesses.

    Note: If your client uses more than one Web service, specify values in the <service-ref> element for each Web service.

  3. For the <service-ref-name> element in the <service-ref> element, specify the name that the Java Naming Directory Interface (JNDI) uses to locate the service. The JNDI lookup string for this service has this format:

    java:comp/env/service-ref-name

    where service-ref-name is . By convention, the value that you specify for service-ref-name should begin with service/.

  4. For the <service-interface> element in the <service-ref> element, specify the class name, including package, of the generated Java interface that is the service interface for this Web service.

  5. For the <wsdl-file> element in the <service-ref> element, specify the WSDL file name used by this client relative to the root of the module.

  6. For the <jaxrpc-mapping-file> element in the <service-ref> element, specify the file name of the generated Java mapping file relative to the root of the module.

  7. For the <service-endpoint-interface> element in the <port-component-ref> element, specify the class name, including package, of the Java interface that is the service endpoint interface for this Web service.

  8. If the Web services client is in an enterprise bean JAR file, manually add the <component-scoped-refs> element. Define the <service-ref> element in the <component-scoped-refs> element if the service reference is being defined within an enterprise bean JAR file, so that the service reference can be associated with the enterprise bean.

    This association is made by using ejb-name from the ejb-jar.xml file as the value of the component-name in the component-scoped-refs element. For more information, see section 7.2.2 of the Web services for J2EE specification.

  9. (Optional) If the Web service is implemented by an enterprise bean in the same module as the client, you can add the <port-component-link> element to optimize access to the service. Add the <port-component-link> to optimize access to the service if the service reference is defined in an EJB JAR file that also contains the EJB that implements the service.

    The <port-component-link> value is set to the <port-component-name> defined in webservices.xml in the same module.

Example

For the AddressBook samples, the <description> element is specified. The default values are used for the remaining elements. The resulting file contains:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE webservicesclient PUBLIC "-//IBM Corporation, Inc.//DTD J2EE Web services client 
1.0//EN" "http://www.ibm.com/webservices/dtd/j2ee_web_services_client_1_0.dtd">
<webservicesclient>
  <service-ref>
    <description>WSDL Service AddressBookService</description>
    <service-ref-name>service/AddressBookService</service-ref-name>
    
<service-interface>com.ibm.websphere.samples.webservices.addr.AddressBookService</service-interface
>
    <wsdl-file>META-INF/wsdl/AddressBook.wsdl</wsdl-file>
    <jaxrpc-mapping-file>META-INF/AddressBook_mapping.xml</jaxrpc-mapping-file>
    <port-component-ref>
      <service-endpoint-interface>com.ibm.websphere.samples.webservices.addr.AddressBook
          </service-endpoint-interface>
    </port-component-ref>
  </service-ref>
</webservicesclient>