HOW TO: Use the Dynamics GP 2010 Web Service

The Dynamics GP web service has a few tricks to it that you have to work through in order to make a call. First and foremost, the web service is not a straight call so using things like SSIS will not work. Secondly, the system is policy based so you may end up looking around a bit for rules. The rules themselves are in the Administrative Tools as Dynamics Security Console. If you encounter any types of errors, the details are logged in a Dynamics GP Web Service security log. This can be found in the Administrative Tools menu as Dynamics GP Web Service Exception Management Console.

To maintain policies in the Dynamics Security Console, connect to your installed application and navigate down to Policy Administration. From here you can select individual sections of the GP business logic and make logical decisions based on how you want to handle your system.

Once your web service is installed and ready, you can use it as a source to add a web service reference to your project.  Simply navigate to the URL http://installedbox:48620/DynamicsGPWebServices/DynamicsGPService.asmx in the Add Service Reference dialog box.

See the code below for an example of how to properly instantiate and pull in your web service with a policy.

VB.NET

wsDynamicsGP10 = New GP10Service.DynamicsGP()
wsDynamicsGP10.Url = "YOURURL"
wsDynamicsGP10.Credentials = New Net.NetworkCredential("User", "Pass', "Domain")

C#

wsDynamicsGP10 = New GP10Service.DynamicsGP();
wsDynamicsGP10.Url = "YOURURL";
wsDynamicsGP10.Credentials = New Net.NetworkCredential("User", "Pass', "Domain");

Here is an example of how to create a company context to create sales orders:

VB.NET

context = New GP2010Service.Context
companyKey = New GP2010Service.CompanyKey
companyKey.Id = "Your Company ID"
context.OrganizationKey = companyKey
context.CultureName = "en-US"
salesPolicy = wsDynamicsGP2010.GetPolicyByOperation("CreateSalesOrder", context)

C#

context = New GP2010Service.Context();
companyKey = New GP2010Service.CompanyKey();
companyKey.Id = "Your Company ID";
context.OrganizationKey = companyKey;
context.CultureName = "en-US";
salesPolicy = wsDynamicsGP2010.GetPolicyByOperation("CreateSalesOrder", context);

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>