Converting Proxies to Strings

This page describes how an application can stringify a proxy and create a property dictionary that captures all the proxy's properties.

On this page:

Stringifying a Proxy

Slice
module Ice 
{
    local interface Communicator
    {
        string proxyToString(Object* obj);
        // ...
    }
}

The communicator operation proxyToString converts a proxy into its stringified representation. Instead of calling proxyToString on the communicator, you can use the ice_toString proxy method to stringify it. However, you can only stringify non-null proxies that way — to stringify a null proxy, you must use proxyToString. (The stringified representation of a null proxy is the empty string.)

proxyToString and ice_toString stringify non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and object adapter id as specified through the Ice.ToStringMode property.

For example:

C++
prx = ...
string str = commmunicator->proxyToString(prx);

// is equivalent to:
string str2;
if(prx)
{
    str2 = prx->ice_toString();
}


proxyToProperty

Slice
module Ice 
{
    dictionary<string, string> PropertyDict;
    local interface Communicator
    {
        PropertyDict proxyToProperty(Object* proxy, string property);
        // ...
    }
}

The proxyToProperty operation returns the set of proxy properties for the supplied proxy. The property parameter specifies the base name for the properties in the returned set.

See Also