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 NAV (Archived)

Exception has been thrown by the Target of an invocation

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,961 Super User 2025 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?

  • saju Profile Picture
    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.

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

  • Verified answer
    saju Profile Picture
    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

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

#1
Saurav.Dhyani Profile Picture

Saurav.Dhyani 2 Super User 2025 Season 2

#2
RK-25090803-0 Profile Picture

RK-25090803-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans