Call .NET DLL in NAV to consume external web service

aniruddha_majumdaraniruddha_majumdar Member Posts: 57
edited 2013-03-01 in NAV Three Tier
Dear All,

We have a scenario where we need to consume an external webservice(SOAP based) exposed by a JAVA application. The web service is pretty simple wherein we have to pass very basic details of Vendor/Employee whenever the same is created NAV 2013. The JAVA application will create an entry based on that.

Our Solution Approach:

We tried both with C# console Application as well as windows application but could NOT end up in utilising the dll in NAV 2013.

Please let me know the right approach to achieve this. If there is any we can use the functionality .NET framework interoperability to consume the external Webservice.

Thanks,
Aniruddha
Thanks & Regards,
Aniruddha

Comments

  • pawanppawanp Member Posts: 90
    Check this out. Hope it helps
    http://mibuso.com/blogs/ara3n/2008/03/06/
  • aniruddha_majumdaraniruddha_majumdar Member Posts: 57
    The solution provided in the solution uses Automation objects which in NAV 2013 does not support.

    I require solution where I can create WS as assembly file which can be used as Dotnet variable.
    Thanks & Regards,
    Aniruddha
  • pawanppawanp Member Posts: 90
  • aniruddha_majumdaraniruddha_majumdar Member Posts: 57
    Thanks Pawan for your prompt reply. Let me give a try.
    Thanks & Regards,
    Aniruddha
  • Wisa123Wisa123 Member Posts: 308
    Had the same Problem, the waldo-blogpost helped me out! Pretty unexpectedly easy.

    Thank you pawan :)
    Austrian NAV/BC Dev
  • aniruddha_majumdaraniruddha_majumdar Member Posts: 57
    The Post really helped me. I am able to consume both external as well as WS service exposed form NAV with in NAV 2013.

    Let me share my findings.


    Step 1: Created a simple CodeUnit which returns a sum of two decimal value

    Function : CheckSum(X : Decimal;Y : Decimal) Z : Decimal
    Z:= X+Y;
    //(Z as return type variable)

    Step 2: Exposed the Webservice: Administration-> IT Administrator ->We Services

    There Add Object Type as Codeunit, Object ID and give a service name (e.g.WSCheckSum)

    Step 3: Create a Windows Class Library (WSSumCheck):

    Open VS 2010 - File -> New Project - >Visual C# -> Windows - Select Class Library

    In the Solution Explorer ( on the right hand side of the Window), Add "Service Reference" by Right Clicking - Advanced-> Add Web Reference -> http://10.33.xxx.xxx:7047/DynamicsNAV70 ... WSCheckSum

    Provide Web Reference Name and "Add Reference". Build the Class Library ( Click Build)

    Step 4: Paste the DLLs in

    C:\Program Files\Microsoft Dynamics NAV\70\Service\Add-ins
    C:\Program Files (x86)\Microsoft Dynamics NAV\70\RoleTailored Client\Add-ins

    Step 5: Web Service Call from Another CodeUnit (WSCallCheckSum)

    Crate Global variables:

    Name DataType
    Z Decimal

    SumCheck DotNet

    Subtype

    WSSumCheck.WebCheckSum.WSCheckSum.'WSSumCheck, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

    In OnRun trigger write the following codes:

    SumCheck:=SumCheck.WSCheckSum();
    SumCheck.UseDefaultCredentials :=TRUE;
    Z:=SumCheck.CheckSum(1,2);

    MESSAGE('Sum := %1',Z);

    Run the Codeunit to get reposnse
    Thanks & Regards,
    Aniruddha
Sign In or Register to comment.