Installing the Lead Service
The Lead Service consists of several components that enable the Microsoft Dynamics GP Services framework to work with lead documents. To install the Lead Service, complete the steps in each of the following sections.
Install the eConnect components
To create, update, delete, and retrieve lead documents, the Lead Service uses custom eConnect SQL stored procedures and Transaction Requester components. To add leads to eConnect, complete the following procedure:
Copy the SQL files to the Dynamics GP data server.
Open the \LeadBusinessObjects\sampleLeadBusObjects\ folder of the Leads Web Service sample. Copy the following SQL script files from the to your Dynamics GP data server:
• sampleErrorCodes.sql
• sampleLeadCreateUpdate.sql
• sampleLeadDelete.sql
• sampleLeadRequester.sql
Open Microsoft SQL Server Management Studio on your Dynamics GP data server.
Run the sampleLeadCreateUpdate SQL script.
In the File menu, point to Open, and then choose File. From the Open File window, navigate to the folder where you copied the SQL script files. Double-click sampleLeadCreateUpdate.sql. The script opens in the query window. In the list of databases, click TWO. To install the stored procedure, choose Execute from the Query menu.
Run the sampleLeadDelete SQL script.
In the File menu, point to Open, and then choose File. From the Open File window, navigate to the folder where you copied the SQL script files. Double-click sampleLeadDelete.sql. The script opens in the query window. In the list of databases, click TWO. To install the stored procedure, choose Execute from the Query menu.
Run the sampleLeadRequester SQL script.
In the File menu, point to Open, and then choose File. From the Open File window, navigate to the folder where you copied the SQL script files. Double-click sampleLeadRequester.sql. The script opens in the query window. In the list of databases, click TWO. To add the Transaction Requester metadata, choose Execute from the Query menu. The script adds metadata for Leads to the eConnect_Out_Setup table of the TWO database.
Run the sampleErrorCodes SQL script.
In the File menu, point to Open, and then choose File. From the Open File window, navigate to the folder where you copied the SQL script files. Double-click sampleErrorCodes.sql. The script opens in the query window. To add the error codes, choose Execute from the Query menu. The script adds the error codes and error messages to the taErrorCode table of the DYNAMICS database.
Hint: If you are using Web Services for Microsoft Dynamics GP in a multitenant environment, you will need to change the database name values in these scripts to correspond to the system database and sample company database names for each tenant.
Install the lead document type assembly
The Lead document type assembly defines the lead, lead summary, and lead criteria objects. To install the assembly, complete the following procedure:
Open the solution file with Visual Studio.
Using Visual Studio, open the file Microsoft.Dynamics.GP.Samples.Leads.sln. Be sure the project is targeting the .NET Framework 4.
Verify the Reference for the project.
Use the Solution Explorer to verify the References. Reload any references that are not able to find the specified .dll file. To reload a reference, browse to the Dynamics GP web services folder, typically found in the following location:
C:\Program Files\Microsoft Dynamics\GPWebServices
Build the assembly.
In the Build menu, choose Build Solution. Visual Studio builds the assembly in the "\bin\debug" or "\bin\retail" folder of the project.
Copy the assembly to the web services server.
Copy the Microsoft.Dynamics.GP.Samples.Leads.dll file to the server where you installed Web Services for Microsoft Dynamics GP. Place the assembly file in the Dynamics GP web services folder, typically found in this location:
C:\Program Files\Microsoft Dynamics\GPWebServices
Add security metadata
To prevent the Lead Service from providing unauthorized access to lead data, add metadata to the Microsoft Dynamics Security Service. To update the Dynamics Security Service, build and run the InstallLeadSecurityMetadata.exe application.
InstallLeadSecurityMetadata adds metadata to the Dynamics Security Service that define five security operations and two tasks you use to manage access to lead operations. In addition, the application adds the operations to the Dynamics Security Service Superuser role.
To build and run the application, complete the following procedure:
Open the solution file with Visual Studio.
Using Visual Studio, open the file named InstallLeadSecurityMetadata.sln. Be sure the project is targeting the .NET Framework 4.
Verify references for the project.
Use Solution Explorer to verify the References. Reload any references that are not able to find the specified .dll file. To reload a reference, browse to the Dynamics GP web services folder, typically found in the following location:
C:\Program Files\Microsoft Dynamics\GPWebServices
Build the application.
In the Build menu, choose Build Solution. Visual Studio builds the application file and the application configuration file in the "\bin\debug" or "\bin\retail" folder of the project.
Install the application and application configuration files.
Find the following application and application configuration files:
• InstallLeadSecurityMetadata.exe
• InstallLeadSecurityMetadata.exe.config
Copy both files to the Dynamics GP web service folder, typically found in this location:
C:\Program Files\Microsoft Dynamics\GPWebServices
Run the application.
To run the InstallLeadSecurityMetadata application, you must be logged in as a user that has permission to update the Dynamics Security Service. The permissions required for this login depend upon the security store you selected when you installed Web Services for Microsoft Dynamics GP. You must use a login that has permission to update your specified security store.
The following table describes the permissions required by each security store.
Security store
Description
Active Directory Application Mode (ADAM)
Log in as user who is an ADAM administrator. If you run the InstallLeadSecurityMetadata application using a login that is not an ADAM administrator, ADAM returns a "System.UnauthorizedAccessException" error. By default, the user who installed Web Services for Microsoft Dynamics GP is an ADAM administrator. To add another user as an ADAM administrator, see the Web Services Installation and Administration Guide.
Active Directory
Log in as a user with permission to open and manage the Active Directory authorization store. Specify the login you use when you open the Authorization Manager console window to view and update application permissions in your Active Directory authorization store.
SQL
Log in as a user with SQL administrator permissions for the database you use to store Dynamics Security Service metadata. The login must have permission to create records in the underlying security tables.
Open a command prompt and change the working location to the folder where you installed InstallLeadSecurityMetadata.exe.
Type the following command and press Enter:
InstallLeadSecurityMetadata.exe /load
If you are using a multitenant environment, include the additional parameter that specifies the tenant to use. For example, to install security metadata for a tenant named Tenant01, you would use the following command:
<pre class="checklistscript" IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml">InstallLeadSecurityMetadata.exe /load Tenant01
View the security metadata changes (optional).
To verify that the InstallLeadSecurityMetadata application succeeded, open the Dynamics Security Console, expand the Microsoft Dynamics GP Web Services node, click Roles, click the Superuser role, and then click Properties. Verify the list of operations includes the Create Leads, Delete Leads, Modify Leads, Query Leads, and View Leads operations.
Add policy metadata
The Lead Service includes methods that create, update, and delete leads. The Dynamics GP WCF service requires a policy object for each of these operations. To add policy metadata, build and run the InstallLeadPolicyMetadata.exe application.
InstallLeadPolicyMetadata adds policies for creating, updating, and deleting a lead. The application also adds a behavior to the create policy that allows you to specify a lead source for a qualified lead. The sample includes a resource assembly that contains the labels displayed for the policy items in the Dynamics Security Console.
To build and run the application, complete the following procedure:
Open the solution file with Visual Studio.
Using Visual Studio, open the file named InstallLeadPolicyMetadata.sln. Be sure the project is targeting the .NET Framework 4.
Verify references for the project.
Use Solution Explorer to verify the References. Reload any references that are not able to find the specified .dll file. To reload a reference, browse to the Dynamics GP web services folder, typically found in the following location:
C:\Program Files\Microsoft Dynamics\GPWebServices
Build the application.
In the Build menu, choose Build Solution. Visual Studio builds the application file and the application configuration file in the "\bin\debug" or "\bin\retail" folder of the project.
Install the application and application configuration files.
Find the following application and application configuration files:
• InstallLeadPolicyMetadata.exe
• InstallLeadPolicyMetadata.exe.config
Copy both files to the Dynamics GP web service folder, typically found in this location:
C:\Program Files\Microsoft Dynamics\GPWebServices
Install the lead policy resource assembly.
The solution includes a second project named Sample.PolicyResources. Copy the Sample.PolicyResources.dll assembly in the "\bin\debug" or "\bin\retail" folder of the project to the Dynamics GP web services folder, typically found in the following location:
C:\Program Files\Microsoft Dynamics\GPWebServices
Check the security permissions of the lead policy resource assembly.
Verify that the Sample.PolicyResources assembly grants Read permission to the user account that is being used as the log on identity for the Microsoft Dynamics GP Service Host service.
To check security permissions for the resource assembly, open the file properties window and click the Security tab. Verify that the groups, users, and permissions specified for the Sample.PolicyResources assembly are the same as those specified for the Microsoft.Dynamics.GP.DataAccess assembly.
Run the application.
Open a command prompt and change the working location to the folder where you installed the InstallLeadPolicyMetadata application. Use command line parameters to install the policy metadata. The second command line parameter specifies the Id of the sample company. Type the following command and press Enter:
InstallLeadPolicyMetadata.exe /load -1
**Hint:** If you have multiple companies installed, and want to use the Lead sample with all of them, you must run the policy loader for each individual company. Otherwise, you will not see the Leads policy object for that company in the Dynamics Security Console.
If you are using a multitenant environment, include the additional parameter that specifies the tenant to use. For example, to install policy metadata for the sample company of a tenant named Tenant01, you would use the following command:
<pre class="checklistscript" IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml">InstallLeadPolicyMetadata.exe /load -1 Tenant01
View the policy metadata changes (optional).
To verify that the InstallLeadPolicyMetadata application succeeded, open the Dynamics Security Console, expand the Microsoft Dynamics GP Web Services node, expand the Policy node, and then click Leads. The console lists policies named Create Lead Policy, Delete Lead Policy, and Update Lead Policy.
Install the service components
The Leads service includes an assembly that defines the interface for the service. To install these components, complete the following procedure:
Open the solution file with Visual Studio.
Using Visual Studio, open the file named SampleLeadService.Contract.sln. Be sure the project is targeting the .NET Framework 4.
Verify references for the project.
Use Solution Explorer to verify the References. Reload any references that are not able to find the specified .dll file. To reload a reference, browse to the Dynamics GP web services folder, typically found in the following location:
C:\Program Files\Microsoft Dynamics\GPWebServices
Verify the base address in the service configuration file
The SampleLeadService.Contract project includes a file named SampleLeadService.config. The file includes configuration information for the endpoints of the native and legacy implementations of the Leads service .
Verify that the machine name and port number of the baseAddress attributes in the configuration file identify the server and port for the native and legacy endpoints of the Leads service. The following example shows the format of the baseAddress for the native endpoint.
<add baseAddress="http://<machine_name>:<port_number>/SampleLeadService.Contract/LeadService" />
Build the application.
In the Build menu, choose Build SampleLeadService.Contract. Visual Studio builds the service SampleLeadService.Contract.dll assembly in the "\bin\debug" or "\bin\retail" folder of the project. Visual Studio also places the file SampleLeadService.config in the "\bin\debug" or "\bin\retail" folder of the project
Install the service assembly.
Copy the SampleLeadService.Contract.dll assembly to the server where you installed Web Services for Microsoft Dynamics GP. Place the SampleLeadService.Contract.dll assembly in the Dynamics GP web service folder, typically found in this location:
C:\Program Files\Microsoft Dynamics\GPWebServices
Install the service configuration file.
Copy the SampleLeadService.config file to the server where you installed Web Services for Microsoft Dynamics GP. Place the SampleLeadService.config file in the Dynamics GP web service "ServiceConfigs" folder, typically found in this location:
C:\Program Files\Microsoft Dynamics\GPWebServices\ServiceConfigs
Edit the service host configuration file
To enable a web service client to connect to the Leads service, the service must be hosted by the Microsoft.Dynamics.GP.ServiceHost.exe service. To add a service to this host, add information about the Leads service to the Microsoft.Dynamics.GP.WebServices.ServiceHost.exe.config file. The configuration file is typically found in this location:
C:\Program Files\Microsoft Dynamics\GPWebServices
Hint: To ensure you can restore the web service to its original functionality, create a copy of the Microsoft.Dynamics.GP.WebServices.ServiceHost.exe.config file. Save the copy to a safe location.
Open the Microsoft.Dynamics.GP.WebServices.ServiceHost.exe.config file in a text editor. Add the following <service> elements to the <services> node:
<service name="SampleLeadService" serviceType="SampleLeadService.Contract.Leads, SampleLeadService.Contract, Version=1.0.0.0, Culture=neutral" ConfigurationFileLocation= "ServiceConfigs\SampleLeadService.config"
/> <service name="SampleLeadServiceLegacy" serviceType="SampleLeadService.LegacyContract.Leads, SampleLeadService.Contract, Version=1.0.0.0, Culture=neutral" ConfigurationFileLocation= "ServiceConfigs\SampleLeadService.config" />
Install the XSLT files.
The Leads service sample includes a Visual Studio solution named SampleLeadXSLT that contains the XSLT files for the Leads service. Find the following files:
• Microsoft.Dynamics.GP.Samples.Lead.LeadCreate.xslt
• Microsoft.Dynamics.GP.Samples.Lead.LeadDelete.xslt
• Microsoft.Dynamics.GP.Samples.Lead.LeadGetByKey.xslt
• Microsoft.Dynamics.GP.Samples.Lead.LeadGetList.xslt
• Microsoft.Dynamics.GP.Samples.Lead.LeadUpdate.xslt
Copy the files to the Dynamics GP web service "XSLT" folder, typically found in this location:
C:\Program Files\Microsoft Dynamics\GPWebServices\XSLT
Restart the Microsoft Dynamics GP Service Host.
To add the Leads service, you must restart the Microsoft Dynamics GP Service Host. Open the Services console, click the service named Microsoft Dynamics GP Service Host, and then stop and restart the service.