Service Data Objects (SDO)
Overview
WebSphere Commerce utilizes Service Data Objects for...
- XML marshalling and unmarshalling
- Code generation from XSD to static Java objects
The SDOs themselves are Java object representations of your nouns, and can be traversed by using getters.
SDO provides the following benefits:
- Simplifies the J2EE data programming model
- Abstracts data in a service-oriented architecture (SOA)
- Unifies data application development
- Supports and integrates XML
- Incorporates J2EE patterns and best practices
In Java, the data objects of the service module (contained in the data object project) are represented as service data objects (SDOs). This module contains the XSDs of the data objects along with the WSDL of the services and the generated SDO code to be used by the component facade implementation and the Java client.
An example of a SDO is...
com.ibm.commerce.member.facade.datatypes.impl.PersonTypeImpl...which implements the interface...
com.ibm.commerce.member.facade.datatypes.PersonTypeTo get information from the SDO, know its XPath. For example, the XPath of a person's logon ID is as follows...
/Person/Credential/LogonIDTo get this information from the Person SDO, you would write the following Java code:
personType.getCredential().getLogonID();When an SDO getter returns a List, refer to the Javadoc to determine the type of the List elements. For example, the list of contacts in a person's address book is of type com.ibm.commerce.foundation.common.datatypes.ContactInfoType:
List contacts = person.getAddressBook().getContact(); for (int i=0; i < contacts.size(); i++) { ContactInfoType contactInfo = (ContactInfoType); contacts.get(i); TelephoneType telephone1 = contactInfo.getTelephone1(); }
SDO annotations
SDO annotations are Eclipse Modeling Framework (EMF) annotations for generating Java code based on XSDs. SDO annotations can be added to the XSD to assist the EMF tooling to specify the package name and XML namespace prefix when creating the .genmodel as a basis to generate SDOs. This extension is to add the following namespace and package declaration to every schema defined. The namespace element is the EMF syntax definition to allow the package attribute to be specified. This package attribute is used by the tools to generate the package name of the generated objects. In the example below, the generated SDO is com.ibm.comerce.catalog.facade.datatypes.
<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:_cat="http://www.ibm.com/xmlns/prod/commerce/9/catalog" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.ibm.com/xmlns/prod/commerce/9/catalog" ecore:nsPrefix="_cat" ecore:package="com.ibm.commerce.catalog.facade.datatypes">For more information, see the article XML Schema to Ecore Mapping on the dev.eclipse.org Web site.
Related Concepts
WebSphere Commerce use of Open Applications Group (OAGIS) messaging
WebSphere Commerce services
WebSphere Commerce service module
Client library for WebSphere Commerce services
Component facade interfacesRelated tasks
Create the SDO genmodel file
Generating code from an SDO genmodel file
Updating Service Data Objects