Converting Proxies to Strings

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

2 min read

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

You can stringify a proxy by calling ice_toString on this proxy. For example:

C++
GreeterPrx greeter{communicator, "greeter:tcp -h localhost -p 4061"};
std::string s = greeter.ice_toString();

ice_toString stringifies non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and adapter ID as specified through the Ice.ToStringMode property.

You can stringify a proxy by calling ToString on this proxy. For example:

C#
GreeterPrx greeter = GreeterPrxHelper.createProxy(
communicator,
"greeter:tcp -h localhost -p 4061");
string s = greeter.ToString();

ToString stringifies non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and adapter ID as specified through the Ice.ToStringMode property.

You can stringify a proxy by calling toString on this proxy. For example:

Java
GreeterPrx greeter = GreeterPrx.createProxy(
communicator,
"greeter:tcp -h localhost -p 4061");
String s = greeter.toString();

toString stringifies non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and adapter ID as specified through the Ice.ToStringMode property.

You can stringify a proxy by calling toString on this proxy. For example:

JavaScript
const greeter = new GreeterPrx(communicator, "greeter:tcp -h localhost -p 4061");
const s = greeter.toString();

toString stringifies non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and adapter ID as specified through the Ice.ToStringMode property.

You can stringify a proxy by calling ice_toString on this proxy. For example:

MATLAB
greeter = GreeterPrx(communicator, 'greeter:tcp -h localhost -p 4061');
s = greeter.ice_toString();

ice_toString stringifies non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and adapter ID as specified through the Ice.ToStringMode property.

You can stringify a proxy by calling ice_toString on this proxy. For example:

PHP
$greeter = GreeterPrxHelper::createProxy(
$communicator,
"greeter:tcp -h localhost -p 4061");
$s = $greeter->ice_toString();

ice_toString stringifies non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and adapter ID as specified through the Ice.ToStringMode property.

You can stringify a proxy by calling ice_toString on this proxy. For example:

Python
greeter = VisitorCenter.GreeterPrx(
communicator,
"greeter:tcp -h localhost -p 4061")
s = greeter.ice_toString()
# Or
s = str(greeter)

ice_toString stringifies non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and adapter ID as specified through the Ice.ToStringMode property.

You can stringify a proxy by calling ice_toString on this proxy. For example:

Ruby
greeter = VisitorCenter::GreeterPrx.new(
communicator,
"greeter:tcp -h localhost -p 4061")
s = greeter.ice_toString()

ice_toString stringifies non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and adapter ID as specified through the Ice.ToStringMode property.

You can stringify a proxy by calling ice_toString on this proxy, or by reading its description property (from protocol CustomStringConvertible). For example:

Swift
let greeter = try makeProxy(
communicator: communicator,
proxyString: "greeter:tcp -h localhost -p 4061",
type: GreeterPrx.self)
let s = greeter.description;

ice_toString (or description, which is equivalent) stringifies non-printable ASCII characters and non-ASCII characters in the proxy's identity, facet and adapter ID as specified through the Ice.ToStringMode property.

You can also perform a deeper proxy stringification by calling proxyToProperty on your communicator. For example:

C++
GreeterPrx greeter{communicator, "greeter:tcp -h localhost -p 4061"};
Ice::PropertyDict propertyMap =
communicator->proxyToProperty(greeter, "Greeter");
C#
GreeterPrx greeter =
GreeterPrxHelper.createProxy(communicator, "greeter:tcp -h localhost -p 4061");
Dictionary<string, string> propertyDict =
communicator.proxyToProperty(greeter, "Greeter");
Java
GreeterPrx greeter = GreeterPrx.createProxy(
communicator,
"greeter:tcp -h localhost -p 4061");
Map<String, String> propertyDict =
communicator.proxyToProperty(greeter, "Greeter");
JavaScript
const greeter = new GreeterPrx(
communicator,
"greeter:tcp -h localhost -p 4061");
const propertyDict = communicator.proxyToProperty(greeter,"Greeter");
MATLAB
greeter = GreeterPrx(communicator, 'greeter:tcp -h localhost -p 4061');
propertyDict = communicator.proxyToProperty(greeter, 'Greeter');
PHP
$greeter = GreeterPrxHelper::createProxy(
$communicator,
"greeter:tcp -h localhost -p 4061");
$propertyDict = $communicator->proxyToProperty($greeter, "Greeter");
Python
greeter = VisitorCenter.GreeterPrx(
communicator,
"greeter:tcp -h localhost -p 4061")
propertyDict: dict[str, str] = communicator.proxyToProperty(greeter, "Greeter")
Ruby
greeter = VisitorCenter::GreeterPrx.new(
communicator,
"greeter:tcp -h localhost -p 4061")
propertyDict = communicator.proxyToProperty(greeter, "Greeter")
Swift
let greeter = try makeProxy(
communicator: communicator,
proxyString: "greeter:tcp -h localhost -p 4061",
type: GreeterPrx.self)
let proxyDict = communicator.proxyToProperty(proxy: greeter, property: "Greeter")

The resulting map or dictionary holds all the proxy properties for the supplied proxy, except its Context properties. The second parameter of proxyToProperty is the base name for the properties in the returned map.