Why..?
Create a Namespace in Windows Azure Service Bus
1. login to Windows Azure
2. Click to Service Bus
3. Create a new namespace 4.created namesapace will have the “Default Issuer” and “Default Key” Creating Service Endpoint & Configure ACS 1. Open the plugin registration tool and Click the “Register New service endpoint” 2. Enter the following details Solution Namespace –The namespace created in windows azure service bus Path- any name Contract- Two way 3. Click “Save and configure ACS” 4. Download the file the from CRM online Settings->Customization->Developer resources 5. Enter the following details Management Key-Default Key of namespace created in azure service bus Certificate File- Upload the downloaded file (windows azure service bus issuer certificate) Issuer name- name specifies in developer resources under customization 6. Click “Configure ACS” 7. Click “Close” 8. Click “Save and verify Authentication” 9. Note down the “ID” of created endpoint from plugin registration tool Service Endpoint ID-“ID” of(Entity)context.InputParameters["Target"]; } // Extract the Organization Service IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); // Extract the tracing service. ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService)); if (tracingService == null) throw new InvalidPluginExecutionException("Failed to retrieve the tracing service."); IServiceEndpointNotificationService cloudService = (IServiceEndpointNotificationService)serviceProvider.GetService(typeof(IServiceEndpointNotificationService)); if (cloudService == null) throw new InvalidPluginExecutionException("Failed to retrieve the service bus service."); tryEntity("contact"); integrationEntity["firstname"] = response; integrationEntity.Id = recordId; service.Update(integrationEntity); } } 2. Register the plugin 3. Pass the “created Service End point ID” under unsecured configuration Create and Run the Listener Application 1.Create a console Application using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xrm.Sdk; using System.ServiceModel; using Microsoft.ServiceBus; using System.ServiceModel.Description; namespace ConsoleApplication7 { //class Program // { // static void Main(string[] args) // { // } // } [ServiceBehavior] public class RemoteService : ITwoWayServiceEndpointPlugin { void ITwoWayServiceEndpointPlugin.Execute(RemoteExecutionContext executionContext) { // throw new NotImplementedException(); context.InitiatingUserId); Console.WriteLine("IsExecutingOffline: {0}", context.IsExecutingOffline); Console.WriteLine("IsInTransaction: {0}", context.IsInTransaction); Console.WriteLine("IsolationMode: {0}", context.IsolationMode); Console.WriteLine("Mode: {0}", context.Mode); Console.WriteLine("OperationCreatedOn: {0}", context.OperationCreatedOn.ToString()); Console.WriteLine("OperationId: {0}", context.OperationId); Console.WriteLine("PrimaryEntityId: {0}", context.PrimaryEntityId); Console.WriteLine("OwningExtension LogicalName: {0}", context.OwningExtension.LogicalName); Console.WriteLine("OwningExtension Name: {0}", context.OwningExtension.Name); Console.WriteLine("OwningExtension Id: {0}", context.OwningExtension.Id); Console.WriteLine("SharedVariables: {0}", (context.SharedVariables == null ? "NULL" : execution context will be shown in the console application.