Object Conversion from Strings and Byte Arrays

Java and .NET Services automatically attempt to convert String/byte[]s to and from Objects when necessary. This is useful when calling these Services from a different language, or when using Service Runners from Batches.

If an argument is not a String or byte[], and it is passed in as such, an attempt is made to convert it. If the data is a byte[], it is first converted to a String. Then the String is converted to the Object as follows:

String Argument to Object Conversion

Input Argument

String Argument-to-Object Conversion

Primitives

The primitive wrapper class’s parse method

Date, Calendar (Java)

DateFormat.getDateTimeInstance().parse

DateTime (.NET)

DateTime.Parse

org.w3c.dom.Document (Java)

Uses the parse method from the DocumentBuilder given by DocumentBuilderFactory.newInstance().newDocumentBuilder()

XmlDocument (.NET)

XmlDocument.loadXml

Other

If the class has a constructor that takes a single String as an argument, it uses that constructor.

If the return value is not a String/byte[], and the client is not of the same language as the Service, the returned value is converted to a String, as follows:

Returned Object to String Conversion

Return Type

Returned Object-to-String Conversion

Primitives

The object-equivalent toString() method

Date, Calendar (Java)

DateFormat.getDateTimeInstance().format

DateTime (.NET)

date.ToUniversalTime().ToString("r", DateTimeFormatInfo.InvariantInfo)

org.w3c.dom.Document (Java)

The transform method from the Transformer given by TransformerFactory.newInstance().newTransformer()

XmlDocument (.NET)

doc.WriteTo(XmlTextWriter)

Other

The toString method