Samples > Sample stores > Consumer direct sample store > IBM Gift Center for the Consumer direct sample store > IBM Gift Center > Customize the Web (presentation) layer
Extend the service interface for the gift registry
To extend the service interface:
- Create a new interface containing the new method. For example, create a Java file called MyGiftRegistryService.java,...
public interface MyGiftRegistryService extends GiftRegistryService { public ConfirmGiftRegistryBOD updateMyGiftRegistry(UpdateGiftRegistryBOD input) throws ServiceException, RemoteException; }
- 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,...
public ConfirmGiftRegistryBOD updateGiftRegistry2( UpdateGiftRegistryBOD input) throws ServiceException, EJBException { ConfirmBOD cBod = (ConfirmBOD) executeBodCommand( input, "com.ibm.commerce.component.giftregistry.commands. UpdateGiftRegistryCmd"); return (ConfirmGiftRegistryBOD)cBod; }
- Verify the WebSphere Commerce configuration file specifies the new JNDI name. The following is an example, using the MyGiftRegistryService.java as the JDNI name in the file (noted in bold below):
<GiftRegistry> <ServiceInterface jndiName="ejb/com/ibm/commerce/component/giftregistry/objects/ MyGiftRegistryServiceHome"/> </GiftRegistry>
The following diagram depicts how the 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.
Call your interfaceOnce you have extended the service interface for the gift registry, you can call the interface from an action. You will need to ensure that this is applicable to the particular interface, as such:
MyGiftRegistryService service = (MyGiftRegistryService) GiftRegistryConnectionUtil.locateService(); service.updateMyGiftRegistry(...);
Related tasks
Create a new IBM Gift Center action
Related reference