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 ATG 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 ATG 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 in the Java client chapter.
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 ATG Web service resulting from your initial Web service call. The response, formatted in XML, holds a string object that represents ATG 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 ATG 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 status.Use 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 don’t exist in .NET and so values for these types are converted as follows:
ATG Map properties use Hashtable data type in .NET.
ATG Date or Timestamp properties are stored as .NET DateTime data type.
ATG Set properties are formatted as .NET Array data type.
ATG properties that refer to other ATG
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 hasn’t been previously deserialized, such as in the case of adding a new item to the ATG platform.A new property value is assigned to an empty
RepositoryItem
.
Note: In order to use the classes in this interface, make sure that the ATG platform atg/repository/xml/RepositoryXMLTools
component has the encodeRepositoryIdAsAttr
property set to true
. This is the default setting.