Tutorial: Defining a User Registration Web Service >
Define the SyncCustomer schema
This section describes the steps involved in creating a new XML schema definition. The XML schema will define a Web service to create customers. Since this tutorial follows the OAGIS structure, the directories in which the XML schema is placed will follow the OAGIS overlay recommendation. After completing this section, you will have an XML schema that is used to define the Web services.
- Under the WebContent/xsd/OAGIS/9.0/Overlays directory of the WebServicesRouter project, create a MyCompany folder.
- Under the newly created MyCompany folder, create a BODs folder which will contain the service XML schema and a Resources > Nouns folder which will contain the Customer data objects.
To create the Customer.xsd schema file:
- In the Project Explorer view, navigate to WebServicesRouter > WebContent > xsd > OAGIS > 9.0 > Overlays > MyCompany > Resources > Nouns.
- Right-click the Nouns folder and select New > Other.
- In the Select a Wizard dialog box, select XML > XML Schema and click Next.
- In the File name field, type Customer.xsd.
- Click Finish to create the XML schema file.
- In the XML Schema Editor, click the Properties tab.
- In the Prefix field, type myco.
- In the Target namespace field, type http://www.mycompany.com/schema.
- Click the Graph tab.
- In the Types section, right-click and and select Add Complex Type.
- Select your new complex type and click the Properties tab.
- In the Name field, type CustomerDemographicsType.
- Double-click CustomerDemographicsType.
- Right-click inside the CustomerDemographicsType section and select Add Sequence.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type Gender.
- In the Type field, click the ... button and select string.
- In the minOccurs field, select 0.
- In the maxOccurs field, select 1.
- Repeat steps 8-9 for the IncomeCurrency, MaritalStatus, Hobbies, and AdditionalInformation elements.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type Age.
- In the Type field, click the ... button and select integer.
- In the minOccurs field, select 0.
- In the maxOccurs field, select 1.
- Repeat steps 11-12 for the Income element.
- Click the arrow in the top left of the XML Schema Editor to return to the schema.
- In the Types section, right-click and and select Add Complex Type.
- Select your new complex type and click the Properties tab.
- In the Name field, type AuthenticationType.
- Double-click AuthenticationType.
- Right-click inside the AuthenticationType section and select Add Sequence.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type Logon.
- In the Type field, click the ... button and select string.
- Repeat steps 19-20 for the Password, PasswordVerify, ChallengeQuestion, and ChallengeAnswer elements.
- Click the arrow in the top left of the XML Schema Editor to return to the schema.
- In the Types section, right-click and and select Add Complex Type.
- Select your new complex type and click the Properties tab.
- In the Name field, type AddressType.
- Double-click AddressType.
- Right-click inside the AddressType section and select Add Sequence.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type StreetAddress.
- In the Type field, click the ... button and select string.
- Repeat steps 27-28 for the City, State, Country, and ZipCode elements.
- Click the arrow in the top left of the XML Schema Editor to return to the schema.
- In the Types section, right-click and and select Add Complex Type.
- Select your new complex type and click the Properties tab.
- In the Name field, type ContactType.
- Double-click ContactType.
- Right-click inside the ContactType section and select Add Sequence.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type FirstName.
- In the Type field, click the ... button and select string.
- Repeat steps 35-36 for the LastName, PhoneNumber, FaxNumber, and Email elements.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type Address.
- In the Type field, click the ... button and select User-defined complex type. Select myco:AddressType and click OK.
- In the maxOccurs field, select 1.
- Click the arrow in the top left of the XML Schema Editor to return to the schema.
- In the Types section, right-click and and select Add Complex Type.
- Select your new complex type and click the Properties tab.
- In the Name field, type CustomerType .
- Double-click CustomerType.
- Right-click inside the CustomerType section and select Add Sequence.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type DisplayName.
- In the Type field, click the ... button and select string.
- In the minOccurs field, select 0.
- In the maxOccurs field, select 1.
- Repeat steps 45-46 for the ParentOrganization, ProfileType, and PreferredCurrency elements.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type Store.
- In the Type field, click the ... button and select integer.
- In the minOccurs field, select 0.
- In the maxOccurs field, select 1.
- Repeat steps 48-49 for the PreferredLanguage element.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type Authentication.
- In the Type field, click the ... button and select User-defined complex type. Select myco:AuthenticationType and click OK.
- In the minOccurs field, select 0.
- In the maxOccurs field, select 1.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type Contact.
- In the Type field, click the ... button and select User-defined complex type. Select myco:ContactType and click OK.
- In the minOccurs field, select 0.
- In the maxOccurs field, select 1.
- Right-click the sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type Demographics.
- In the Type field, click the ... button and select User-defined complex type. Select myco:CustomerDemographicsType and click OK.
- In the minOccurs field, select 0.
- In the maxOccurs field, select 1.
- Click the arrow in the top left of the XML Schema Editor to return to the schema.
- In the Elements section, right-click and select Add Element.
- Select your new element and click the Properties tab.
- In the Name field, type Customer.
- In the Type field, click the ... button and select User-defined complex type. Select myco:CustomerType and click OK.
- Save your work and close the XML Schema Editor.
Under the MyCompany/BODs directory, create another XML schema to define the SyncCustomer service that will extend from the OAGIS BusinessObjectDocument. To create the SyncCustomerType.xsd schema file:
- In the Project Explorer view, navigate to WebServicesRouter > WebContent > xsd > OAGIS > 9.0 > Overlays > MyCompany > BODs.
- Right-click the BODs folder and select New > Other.
- In the Select a Wizard dialog box, select XML > XML Schema and click Next.
- In the File name field, type SyncCustomerType.xsd.
- Click Finish.
- Open SyncCustomerType.xsd.
- Click the Properties tab.
- In the Prefix field, type myco.
- In the Target namespace field, type http://www.mycompany.com/schema.
- Click the Graph tab.
- Import the BOD.xsd schema file:
- Right-click inside the Directives section and select Add Import.
- Select the new import and click the Properties tab.
- In the Schema location field, click the ... button.
- Select Workbench projects and click Next.
- Expand WebContent > xsd > OAGIS > 9.0 > Resources > Nouns.
- Select BOD.xsd and click Finish.
- Click the Properties tab.
- In the Prefix field, type oa.
- Include the the Customer.xsd schema file:
- Right-click inside the Directives section and select Add Include.
- Select the new include and click the Properties tab.
- In the Schema location field, click the ... button.
- Select Workbench projects and click Next.
- Expand WebContent > xsd > OAGIS > 9.0 > Overlays > MyCompany > Resources > Nouns.
- Select Customer.xsd and click Finish.
- Right-click inside the Types section and select Add Complex Type.
- Select the new complex type and click the Properties tab.
- In the Name field, type SyncCustomerDataAreaType.
- Double-click SyncCustomerDataAreaType.
- Right-click inside the SyncCustomerDataAreaType section and select Add Sequence.
- Right-click the sequence and select Add Element Ref.
- Select the new element and click the Properties tab.
- In the ref field, select oa:Sync.
- Right-click the sequence and select Add Element Ref.
- Select the new element and click the Properties tab.
- In the ref field, select myco:Customer.
- In the maxOccurs field, select 1.
- Click the arrow in the top left of the XML Schema Editor to return to the schema.
- Right-click inside the Types section and select Add Complex Type.
- Select the new complex type and click the Properties tab.
- In the Name field, type SyncCustomerType.
- In the Base type field, click the ... button and select User-defined complex type. Select oa:BusinessObjectDocumentType and click OK.
- Double-click SyncCustomerType.
- Right-click the bottom sequence and select Add Element.
- Select the new element and click the Properties tab.
- In the Name field, type DataArea.
- In the Type field, click the ... button and select User-defined complex type. Select myco:SyncCustomerDataAreaType and click OK.
- Click the arrow in the top left of the XML Schema Editor to return to the schema.
- Right-click inside the Elements section and select Add Element.
- In the Name field, type SyncCustomer.
- In the Type field, click the ... button and select myco:SyncCustomerType.
- Save your work and close the XML Schema Editor.
After completing this section of the tutorial, you can verify that your XML schemas are correct by comparing the source code of your schemas with the source code of Customer.xsd and SyncCustomerType.xsd in the sample zip file.