Tutorial: Customizing Web 2.0 and Web services to support personalization > < Previous | Next >
Create the overlay type
In this step you will create an XSD file that extends the OrderItemType to include your new engraving attributes. Ensure the EMF capability is enabled In you development workspace, click Windows > Preferences > Workbench > Capabilities. Expand Eclipse Developer and ensure that the Eclipse Modeling Framework (EMF) selection is checked. Click OK.Create your XSD file MyExtensionType.xsd Create an XSD using the recommended OAGIS directory structure and your custom namespace that contains the extended complex type with the additional elements and attributes.
- In WebSphere Commerce Developer, expend the Dynamic Web Projects folder.
- Right-click WebServicesRouter and select Refresh.
- Navigate to WebServicesRouter/WebContent/component-services/xsd/OAGIS/9.0/Overlays.
- Create a folder by right-clicking Overlays and selecting New > Folder. In the name field type MyCompany then click Finish. Click MyCompany and create a new folder called Commerce. Add another folder inside Commerce called Resources and a folder called Components inside of Resources. Your folder structure should look similar to the following screen capture.
- Right-click the Components folder and select New > Other. Expand the XML folder and select XML Schema.
- Name the file MyExtensionType.xsd and click Finish.
- Open the new XSD file and replace the contents with the following code. This XML schema definition defines the overlay types that extend OrderItem to EngravingOrderItem, and the required supporting types (EngravingOrderItemTextType).
<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:oa="http://www.openapplications.org/oagis/9" xmlns:myord="http://www.mycompany.com/xmlns/prod/commerce/9/order" xmlns:_ord="http://www.ibm.com/xmlns/prod/commerce/9/order" targetNamespace="http://www.mycompany.com/xmlns/prod/commerce/9/order" elementFormDefault="qualified" attributeFormDefault="unqualified" ecore:nsPrefix="myord" ecore:package="com.mycompany.commerce.order.facade.datatypes"> <import namespace="http://www.ibm.com/xmlns/prod/commerce/9/order" schemaLocation="../../../../IBM/Commerce/Resources/Nouns/Order.xsd" /> <complexType name="EngravingOrderItemType"> <complexContent> <extension base="_ord:OrderItemType"> <sequence> <element name="EngravingText" type="myord:EngravingTextType" minOccurs="0" maxOccurs="unbounded"> </element> </sequence> </extension> </complexContent> </complexType> <element name="EngravingOrderItem" type="myord:EngravingOrderItemType" substitutionGroup="_ord:OrderItem"> </element> <complexType name="EngravingTextType"> <simpleContent> <extension base="string"> <attribute name="font" type="string"></attribute> <attribute name="size" type="string"></attribute> </extension> </simpleContent> </complexType> </schema>- Save and close the file.