Open topic with navigation

TIBCO GridServer® 7.1.0

# Object Conversion from Strings and Byte Arrays

Java and .NET Services automatically attempt to convert `String/byte[]`s to and from `Object`s 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

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO GridServer®

Copyright © 2001-2022. TIBCO Software Inc. All Rights Reserved.