Skip to main content

Notifications

Announcements

No record found.

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

Posted on by Microsoft Employee

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

  • Praveen Kumar RR Profile Picture
    Praveen Kumar RR 1,550 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

  • Community Member Profile Picture
    Community Member Microsoft Employee 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

  • Suggested answer
    Praveen Kumar RR Profile Picture
    Praveen Kumar RR 1,550 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
    Community Member Microsoft Employee 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.

  • Community Member Profile Picture
    Community Member Microsoft Employee 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>

  • Suggested answer
    Praveen Kumar RR Profile Picture
    Praveen Kumar RR 1,550 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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans