The Atg.DotNet.WebService
API is a mechanism that you can use to serialize and deserialize RepositoryItem
content. The primary role of this API is to:
Converts a
RepositoryItem
into an XML document (serialization)Formats an XML document into a
RespositoryItem
(deserialization)
By understanding the Oracle ATG Web Commerce RepositoryItem
API, Atg.DotNetWebService.RepositoryItem
is able to convert into objects any content that uses the RepositoryItem
API for its underlying data type. You can use this API for Oracle ATG Web Commerce and custom Web Services that access RepositoryItems
.
The Atg.DotNet.WebService
is made up of the following classes:
Note: Rather than use this API, you could generate an XML schema representation of the RepositoryItem
and use that serialize/deserialize content. The advantage of using an XML schema is that you can control the properties you use, meaning you can easily exclude certain properties from your schema. You may find the disadvantages, namely the limitations in property types and values that this method supports, reason to use the provided API instead. For instructions on how to use an XML schema for serialization/deserialization, see the Creating a Serializer and Deserializer.
About the Atg.DotNet.WebService API
Collectively, these classes provide you with the ability to serialize and deserialize RepositoryItems
and to configure both processes. Although this discussion specifically describes the serialization process, the same principles apply to both processes.
When you want to deserialize content from a Web Service, for example, you use the response sent by Oracle ATG Web Commerce Web Service resulting from your initial Web Service call. The response, formatted in XML, holds a string object that represents Oracle ATG Web Commerce RepositoryItems
. Once you make the call to the API to deserialize the string, the deserializer parses the string into a RepositoryItem
object.
Not all content in the string is emitted by the serializer. By default, only content specified as “dirty,” meaning a different value for it exists in the Oracle ATG Web Commerce platform and the external system .NET communicates with, is serialized. Once an item has been serialized, there’s parity across systems so all properties on that item are marked as “clean.” You can alter the default dirty/clean designation in the following ways:
Use the
RepositoryItem.Dirty
property to toggle an object’s clean/dirty statusUse the
RepositoryItem.setPropertyDirty()
methods to toggle a property’s clean/dirty status
During deserialization, content that represents RepositoryItem
properties is parsed based on a few rules. All properties are converted back to the native data type, assuming that data type is available in .NET. The following data types do not exist in .NET and so values for these types are converted as follows:
Oracle ATG Web Commerce Map properties use Hashtable data type in .NET
Oracle ATG Web Commerce Date or Timestamp properties are stored as .NET DateTime data type
Oracle ATG Web Commerce Set properties are formatted as .NET Array data type
Oracle ATG Web Commerce properties that refer to other Oracle ATG Web Commerce
RepositoryItems
behave as .NET Hashtables
For the most part, Atg.DotNet.WebService
determines format output type by relying on prior processing. For example, if it had deserialized a particular RepositoryItem
, such a Growth fund, then assuming no new properties are added, when the Growth fund is serialized, Atg.DotNet.WebService.RepositoryItem
is aware of each property’s destination data type. However, in all other circumstances, you should explicitly include the XML data type for the property. In short, under these circumstances include data types:
The first time a
RepositoryItem
is serialized when it has not been previously deserialized, such as in the case of adding a new item to the Oracle ATG Web Commerce platformA new property value is assigned to an empty
RepositoryItem
Note: In order to use the classes in this interface, make sure that the Oracle ATG Web Commerce platform atg/repository/xml/RepositoryXMLTools
component has the encodeRepositoryIdAsAttr
property set to true
. This is the default setting.
RepositoryItem Class
The Atg.DotNet.WebService.RepositoryItem
class is designed to manage XML serialization and deserialization for easy interoperability with the .NET Web Services framework.
To serialize or deserialize a RepositoryItem
, you need only to pass in the RepositoryName
and RepositoryId
. When you are working with content for the first time, you also need to call setPropertyType
to instruct the deserializer/serializer to use a specific output data type.
Class Element | Description |
---|---|
properties |
|
constructors |
|
methods |
|
Property Class
This class represents a given property’s name and value.
Class Element | Description |
---|---|
properties |
|
constructor |
|
methods |
|
RepositoryItemRef Class
This class represents a reference to another RepositoryItem
.
Class Element | Description |
---|---|
properties |
|
method |
|
Complex Type Class
This class permits you to serialize/deserialize properties that use complex types by specifying an output data type explicitly.
Class Element | Description |
---|---|
properties |
|
constructor |
|
methods |
|
NoSuchPropertyException Class
This class generates an exception each time a getProperty
or getPropertyValue
method tries to interact with a property that has not been specified for the designated RepositoryItem
.
Class Element | Description |
---|---|
property |
|
constructor |
|
RepositoryItemSerializer Class
This class conducts serialization/deserialization and permits you to decide if you want all or only dirty properties to be updated.
Class Element | Description |
---|---|
constructors |
|
methods |
|
RepositoryItemSerializationException Class
This class creates an exception object when errors occur during serialization or deserialization.
Class Element | Description |
---|---|
constructor |
|