Running the Sales Documents sample
To run this sample application, perform the following steps:
Verify the Dynamics GP service.
To ensure Dynamics GP service is installed and ready, enter the service URL into the address bar of the web browser. The default URL for the native endpoint is:
http://<machine_name>:< port number>/Dynamics/GPService
Typically, the port number is 48620. If the browser displays a message that states you have created a service, your service is ready to use with the sample application.
Start Visual Studio and open the solution file for the sample application.
The solution file for this sample is named SalesDocumentSample.sln. The solution file is in the SalesDocument(native) folder inside the Samples folder.
Verify the .NET framework.
Open the Visual Studio Solution Explorer and right-click the SalesDocumentSample project name. From the menu, click Properties. In the Application tab of the Properties window, verify that the Target Framework shows .NET Framework 3.5 or later.
If Target Framework shows another .NET framework, use the drop down list to specify .NET Framework 3.5 or later.
Delete the existing service reference.
In the Solution Explorer, expand the Service References folder. Right-click the DynamicsGPService, and then click Delete. If a message box opens and asks whether to proceed, click OK.
Update the service reference.
Right-click the Service Reference folder in the Solution Explorer, and click Add Service Reference. In the Add Service Reference window, enter the URL of the native endpoint for the Dynamics GP service in the Address field, and then click Go.
In the list of Services, click Dynamics GP. Enter DynamicsGPService into the Namespace field and then click OK. The service reference is added to your project.
Enable the asynchronous web methods in the Service Reference.
In the Solution Explorer, right-click DynamicsGPService, and then click Configure Service Reference. In the Client section of the Service Reference Settings window, mark Generate asynchronous operations, and then click OK.
Generate configuration settings.
If you use Visual Studio 2008, you have to generate configuration settings for the application. If you use Visual Studio 2010 or later, you can continue to step 9.
To generate the configuration settings, you use svcutil.exe. You can run svcutil.exe in a Visual Studio Command Prompt window. To open the window, click the Start menu, find and click Visual Studio, click Visual Studio Tools, right-click Visual Studio Command Prompt, and then click Run as administrator. The Visual Studio Command Prompt window opens.
To use svcutil.exe, you specify the URL of the native endpoint for the Dynamics GP service and the namespace of the service reference that you created (DynamicsGPService). Enter the following on a single line and then press Enter.
svcutil.exe http://<machine>:<port>/Dynamics/GPService /n:*,DynamicsGPService
The svcutil.exe utility creates a file named output.config. Note the location of the output.config file.
Add configuration settings to the app.config file.
If you use Visual Studio 2008, you have to add the configuration settings to the application configuration file for your project. If you use Visual Studio 2010 or later, you do not need to add the configuration settings and can continue to the next step.
To add the configuration settings, use the Visual Studio Solution Explorer to find and open the app.config file. For example, double-click app.config under SalesDocumentSample.
Open the output.config file from the previous step in a text editor. Copy the <system.serviceModel> node from the output.config file and add it to the app.config file.
Update the app.config file.
To ensure the document sample application works with the messages received from the service, you need to change the default value for attributes of several nodes in the <wsHttpBinding> node of the app.config file. The following XML sample shows how to increase values for the attributes of the <binding> node.
maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
The following XML sample increases the value for an attribute in the \<readerQuotas\>node
<pre class="checklistscript" IsFakePre="true" xmlns="http://www.w3.org/1999/xhtml">maxNameTableCharCount="2147483647"
Save the changes to the app.config file.
Choose Start Debugging from the Debug menu.
To build the solution, choose "Start Debugging" in the Debug menu. The sales document sample application loads the service proxy which may take several seconds to complete. The application will not be visible until loading the service proxy has completed.
Select a company from the Company drop-down list.
Once a company is selected, the Customer drop-down list contains all the customers for that company.
Select a customer from the Customer drop-down list.
After a customer is selected, the data grid displays all the sales documents for that customer.
Mark one or more of the check boxes in the Sales Documents list.
Use the check boxes to restrict the types of sales documents displayed in the data grid.
Click the Refresh button.
The Refresh button forces the data grid to update and display only the specified document types for the customer.