Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Exception has been thrown by the Target of an invocation

Posted on by 615

I write one C#(2008) web service for  SQL Server& DynamicsNAV ( Page webservice ID 39 ) Intergation.I am facing an issue that

NavService.Create(“GenJnl”,ref LedEntry);

When fire this statement error occurred “Exception has been thrown by the Target of an invocation”.

plz help me to solve this issue

*This post is locked for comments

  • Verified answer
    saju Profile Picture
    saju 615 on at
    RE: Exception has been thrown by the Target of an invocation

    i got issue .I changes  the code

    NavService.Create(“GenJnl”,ref LedEntry);

    to

    NavService.Create(“CASH”,ref LedEntry);

    Then working fine

  • saju Profile Picture
    saju 615 on at
    RE: Exception has been thrown by the Target of an invocation

    Hi,Sankar,

    I try leaning ,how to insert vouchers into Dynamics NAV I got one valuable URL.

    dynamicsuser.net/.../34440.aspx

    But I don’t know that page code for web service.so I try with 39.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Exception has been thrown by the Target of an invocation

    This is d sample code for creating customer master.. you can find this sample code from navision help file and there are some others codes too...

    .//****

     Customer_Service service = new Customer_Service();

               service.UseDefaultCredentials = true;

               // Creates instance of customer.

               Customer cust = new Customer();

               cust.Name = "Customer Name";

               Msg("Pre Create");

               PrintCustomer(cust);

               // Inserts customer.

               service.Create(ref cust);

    //*****

    May i know , why you are inserting into  General Ledger Entry table...Its Strictly not advisable ......

  • saju Profile Picture
    saju 615 on at
    RE: Exception has been thrown by the Target of an invocation

    Hi Mohana Yadav, Thank you for your valuable replay. I want to time to check bcos i am new in dynamics.my code is below:

    C# CodeSnippet below

    Gen_Ledger_Entry_Service    Service = new  Gen_Ledger_Entry_Service();

    Service.UseDefaultCredentials = true;

    Service.Url   =  “http://localhost:7047/DynamicsNAV/WS/CRONUS_International_Ltd Page/Gen_Ledger_Entry

    Gen_Ledger_Entry  GenEN=new Gen_Ledger_Entry();

    GenEN.Document_Type=0;

    GenEN.Document_No =”4344”   .......... and so on

    GenEN..Create(“GenJnl”,ref LedEntry);

    If u possible plz suggest me any URL relate RTC with NAV Service.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Exception has been thrown by the Target of an invocation

    Do you have any info on event viewer?

    Did you try to run Page 39 from RTC?

    Was it running fine?

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans