web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

I want to create a customer in Dynamics GP through GP WebServices and I wrote some code but throwing an exception as Insufficient Authorization to perform this Action.My code is here

(0) ShareShare
ReportReport
Posted on by

I want to create a customer in Dynamics GP through GP WebServices and I wrote some code but throwing an exception as Insufficient Authorization to perform this Action.My code is here

try
{
CompanyKey companyKey;
Context context;
Customer customer;
CustomerKey customerKey;
Policy customerPolicy;

// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();

// Create a context with which to call the service
context = new Context();

// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);

// Set up the context
context.OrganizationKey = (OrganizationKey)companyKey;

// Create a new customer object
customer = new Customer();

// Create a customer key
customerKey = new CustomerKey();
customerKey.Id = "CONTOSO";
customer.Key = customerKey;

// Set properties for the new customer
customer.Name = "Contoso,Ltd";

// Get the create policy for the customer
customerPolicy = wsDynamicsGP.GetPolicyByOperation("CreateCustomer", context);

// Create the customer
wsDynamicsGP.CreateCustomer(customer, context, customerPolicy);

// Close the service
if (wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
catch(Exception ex)
{
throw ex;
}2844.123.jpg

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Praveen Kumar RR Profile Picture
    1,552 on at
    RE: I want to create a customer in Dynamics GP through GP WebServices and I wrote some code but throwing an exception as Insufficient Authorization to perform this Action.My code is here

    Hi Mallesh,

    Similar error occur in my eConnect code and resolution for this to provide "INTEGRATED SECURITY" instead of "SA" credentials in Config File of the Project.

    I suggest you to check your WEBCONFIG file and perform this step.

    Thanks,

    Praveen

  • Community Member Profile Picture
    on at
    RE: I want to create a customer in Dynamics GP through GP WebServices and I wrote some code but throwing an exception as Insufficient Authorization to perform this Action.My code is here

    Sir, I'm doing in Console Application and in that  App.Config file has settings as follows

    <configuration>

       <startup>

           <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />

       </startup>

       <system.serviceModel>

           <bindings>

               <basicHttpBinding>

                   <binding name="LegacyDynamicsAdminService">

                       <security mode="TransportCredentialOnly">

                           <transport clientCredentialType="Ntlm" />

                       </security>

                   </binding>

               </basicHttpBinding>

               <wsHttpBinding>

                   <binding name="GPWebService" />

               </wsHttpBinding>

           </bindings>

           <client>

               <endpoint address="sql/DynamicsAdminService.asmx&quot;

                   binding="basicHttpBinding" bindingConfiguration="LegacyDynamicsAdminService"

                   contract="DynamicsSecurityAdminService.ILegacyAdminService"

                   name="LegacyDynamicsAdminService" />

               <endpoint address="sql/.../GPService&quot;

                   binding="wsHttpBinding" bindingConfiguration="GPWebService"

                   contract="NativeServiceGP.DynamicsGP" name="GPWebService">

                   <identity>

                       <userPrincipalName value="setup@jispl.com" />

                   </identity>

               </endpoint>

           </client>

       </system.serviceModel>

    </configuration>

  • Community Member Profile Picture
    on at
    RE: I want to create a customer in Dynamics GP through GP WebServices and I wrote some code but throwing an exception as Insufficient Authorization to perform this Action.My code is here

    Hi Praveen Kumar RR

    Please Suggest me where to change in above code.

  • Suggested answer
    Praveen Kumar RR Profile Picture
    1,552 on at
    RE: I want to create a customer in Dynamics GP through GP WebServices and I wrote some code but throwing an exception as Insufficient Authorization to perform this Action.My code is here

    Mallesh,

    I am not familiar with WEBSERVICES, i have idea only on eConnect and below refer below the XML config file which works fine,

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

       <startup>

           <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />

       </startup>

    <connectionStrings>

     <clear />

         <add name="sourcedb" providerName="System.Data.SqlClient" connectionString="Server=SourceSQLInstance;Database=sourcedb;User Id=sa;Password=sapassword;Persist Security Info=True;MultipleActiveResultSets=True" />

    <add name="destinationdb" providerName="System.Data.SqlClient" connectionString="Server=GPSQLInstance;Database=destinationdb;User Id=sa;Password=sapassword;Persist Security Info=True;MultipleActiveResultSets=True" />

    </connectionStrings>

    </configuration>

    Please replace above settings in your APPCONFIG with credentials of your's.

    Thanks,

    Praveen

  • Community Member Profile Picture
    on at
    RE: I want to create a customer in Dynamics GP through GP WebServices and I wrote some code but throwing an exception as Insufficient Authorization to perform this Action.My code is here

    No Sir Its Not working

  • Praveen Kumar RR Profile Picture
    1,552 on at
    RE: I want to create a customer in Dynamics GP through GP WebServices and I wrote some code but throwing an exception as Insufficient Authorization to perform this Action.My code is here

    If you have skype please let me know, we shall have a session

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Victoria Yudin Profile Picture

Victoria Yudin 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans