Extending the service interface for the gift registry

To extend the service interface:

  1. Create a new interface containing your new method. For example, create a Java file called MyGiftRegistryService.java, as follows:
    public interface MyGiftRegistryService   
     extends GiftRegistryService {    
    
     public ConfirmGiftRegistryBOD     
      updateMyGiftRegistry(UpdateGiftRegistryBOD input)  
      throws ServiceException, RemoteException; }  
    
  2. Create a new stateless session bean which extends the existing service interface session bean, and implements the newly created interface. For example, create a bean called MyGiftRegistryServiceBean, as follows:
    public ConfirmGiftRegistryBOD updateGiftRegistry2(
     UpdateGiftRegistryBOD input)  
     throws ServiceException, EJBException {     
    
     ConfirmBOD cBod = (ConfirmBOD) 
      executeBodCommand(
       input,
       "com.ibm.commerce.component.giftregistry.commands.
        UpdateGiftRegistryCmd");
     return (ConfirmGiftRegistryBOD)cBod;
    }
    
  3. Ensure that the WC_installdir/instances/instance/xml/instance.xml file specifies your new JNDI name. The following is an example, using the MyGiftRegistryService.java as the JDNI name in the instance.xml file (noted in bold below):
    <GiftRegistry>
     <ServiceInterface 
     jndiName="ejb/com/ibm/commerce/component/giftregistry/objects/
      MyGiftRegistryServiceHome"/>
    </GiftRegistry>
    

The following diagram depicts how your session bean class structure should look. The two classes within the box are the plain Java interfaces (not EJB classes). All the other classes are the session bean files. All the arrows in the diagram represent an extends relationship between Java classes.

Calling your interface

Once you have extended the service interface for the gift registry, you can call your interface from an action. You will need to ensure that this is applicable to your particular interface, as such:

MyGiftRegistryService service =   
 (MyGiftRegistryService)   
  GiftRegistryConnectionUtil.locateService(); 
service.updateMyGiftRegistry(...);