1.3.2 Finding the RPC Endpoint and Constructing a Binding Handle

When a partner is initialized, it creates a dynamic endpoint on each of its supported RPC protocols and registers the interface (IXnRemote) with the RPC endpoint mapper. When a partner performs this registration, it specifies its contact identifier (CID) as the object identifier. See specification [C706].

A partner initiating communication with another partner begins with a name object that contains contact information for a remote partner. The name object is used to create an RPC binding handle (see specification [C706]) to the remote partner's RPC endpoint.

To create an RPC binding handle from a name object, a string binding has to be generated by calling the RPC API routine rpc_string_binding_compose (see specification [C706] section 3.1.20) and passing the data from the name object as follows:

  1. The protseq input value is taken from one of the entries in the Protocols list in the name object. The protocol has to be one of the protocols supported by both partners as specified in section 2.1.1. The protocol is selected from the Protocols list according to the following heuristic:

    1. If both partners are on the same machine, use the value "ncalrpc"; otherwise, proceed to the next step.

    2. If "ncacn_ip_tcp" is on the Protocols list, set this protocol as the value; otherwise, proceed to the next step.

    3. If "ncacn_spx" is on the Protocols list, set this protocol as the value;<1> otherwise, proceed to the next step.

    4. If "ncacn_nb_nb" is on the Protocols list, set this protocol as the value; otherwise, proceed to the next step.

    5. The partner fails to generate a string binding.

  2. The network_addr input value is specified as the Hostname in the name object.

  3. The obj_uuid input value is specified as the contact identifier (CID) in the name object.

  4. Set NULL or empty string("") for the endpoint and options input values.

After generating the string binding, the partner can instantiate a RPC binding handle passing the string binding to the rpc_binding_from_string_binding RPC API routine (see specification [C706] section 3.1.20). Because the string binding doesn't define an endpoint field, the returned binding is a partially bound binding handle.

If, for any reason, a partner fails to generate a string binding or to instantiate a RPC binding handle, an implementation-specific error code is returned.

This partial binding is resolved into a full binding by using the RPC endpoint mapper service at the host network address and the full binding handle is used for every call to the remote partner.