I have installed 2 different SharePoint 2010 Farms with all service applications installed.
- The Publishing Farm: That’s the farm that Publish the Service Application.
- Consuming Farm: That’s the farm that Connects to the Remote Service Application.
First off all i create a Trust between the 2 Different Farms so that I can publish the Search Service Application. You must provide two trust certificates to the publishing farm: a root certificate and a security token service (STS) certificate and the publishing farm must provide a root certificate to the consuming farm.
Export the root certificate from the consuming farm:
1. Start SharePoint 2010 PowerShell
2. I have typed 2 PowerShell Commands to export the root certificate from the consuming farm. I have created the certificate on the C drive for example.
- $rootCert = (Get-SPCertificateAuthority).RootCertificate
- $rootCert.Export("Cert") | Set-Content C:\ConsumingFarmRoot.cer -Encoding byte
Export the STS certificate from the consuming farm:
1. Again I typed 2 PowerShell commands:
- $stsCert = (Get-SPSecurityTokenServiceConfig).LocalLoginProvider.SigningCertificate

When you enter this command you will see this error. So what you can do is remove the Config command from the Powershell commando (Get-SPSecurityTokenConfig) So then you Type (Get-SPSecurityTokenService) and it works fine!
- I typed the second command: $stsCert.Export("Cert") | Set-Content C:\ConsumingFarmSTS.cer -Encoding byte
Export the root certificate from the publishing farm
1. Click SharePoint 2010 Management Shell.
2. Typed again the 2 following Commands:
- $rootCert = (Get-SPCertificateAuthority).RootCertificate
- $rootCert.Export("Cert") | Set-Content C:\PublishingFarmRoot.cer -Encoding byte
copy the certificates
- I Copy the root certificate and the STS certificate from the server in the consuming farm to the server in the publishing farm.
- The I Copy the root certificate from the server in the publishing farm to the a server in the consuming farm.
Import the root certificate and create a trusted root authority on the consuming farm
1. At the Windows PowerShell command prompt on a server in the consuming farm, I typed the following commands, and then press ENTER after each command
o $trustCert = Get-PfxCertificate C:\PublishingFarmRoot.cer
o New-SPTrustedRootAuthority PublishingFarm -Certificate $trustCert
Import the root certificate and create a trusted root authority on the publishing farm
1. To establish trust on the publishing farm, you must import the root certificate that was copied from the consuming farm and create a trusted root authority. You must then import the STS certificate that was copied from the consuming farm and create a trusted service token issuer.
I used the following 2 commands to import the root certificate:
o $trustCert = Get-PfxCertificate C:\ConsumingFarmRoot.cer
o New-SPTrustedRootAuthority ConsumingFarm -Certificate $trustCert
import the STS certificate and create a trusted service token issuer on the publishing farm
1. An the Last PowerShell command to import the STS certificate:
o $stsCert = Get-PfxCertificate c:\ConsumingFarmSTS.cer
o New-SPTrustedServiceTokenIssuer ConsumingFarm -Certificate $stsCert
As you can see I have created an Trust between 2 different farms.

So after that you can publisch you Service Application. In my cas I hav choosing for the Search Service Application.
- Verify that the user account that is performing this procedure is a member of the Farm Administrators SharePoint group.
- On the SharePoint Central Administration Web site, click Application Management, and then click Manage service applications.
- Click the row that contains the service application that you want to publish. Commands on the ribbon become available.
- On the ribbon click Publish.
So as you can see you must selected the option Publish this Service Application to other farms.

Also in this option you will see a Published URL. Copy this Url to Notepad and keep it Safe!

So Click on Ok an your Service Application has been published.
connect to a service application on a remote farm by using Central Administration
- On the SharePoint Central Administration Web site, click Application Management, and then click Manage service applications.
- On the ribbon, click Connect.
- On the Connect drop-down menu, click the kind of service application to which you want to connect.

- Then I have chosen for the Search Service Proxy.
- Copy the Published Url that you copied Farm or Service Application address.

- Click on OK
- The new Connect to a Remote Service Application dialog box displays the service applications that match the URL that you typed in the earlier Step. Click the row that contains the name of the service application, and then select the check box to add the service application connection to the farm’s default list of service application connections (default proxy group). Click OK

- You are prompted to change the connection name. Type a new name into the Connection Name text box or leave the default name, and then click OK.

- After the new connection is created, you must click OK to complete the procedure.
- You must associate the new service application connection with a local Web application
- 
- Finish. Its Easy!!