Tutorials > Program model > Web services > Customize Web 2.0 and Web services to support personalization

< Previous | Next >


Create the overlay type

In this step we will create an XSD file that extends the OrderItemType to include the new engraving attributes. Create an XSD using the recommended OAGIS directory structure and the custom namespace that contains the extended complex type with the additional elements and attributes.


Procedure

  1. In WebSphere Commerce Developer.

  2. Right-click WebServicesRouter; then click Refresh.

  3. Navigate to WebServicesRouter/WebContent/component-services/xsd/OAGIS/9.0/Overlays.

  4. 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.

  5. Right-click the Components folder and select New > Other. Expand the XML folder and select XML Schema.

  6. Name the file MyExtensionType.xsd and click Finish.

  7. 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>
    

  8. Save and close the file.

< Previous | Next >


+

Search Tips   |   Advanced Search