Getting error calling web service.

SuDSuD Member Posts: 102
Hi all,

I published a web service of type codeunit, and in this CU I wrote some functions in one function I wrote some code about calling a external API, and I m consuming that web service in my C# code.
But when the "GetResponse" function going to execute in C/AL I m getting exception in C#, below is the screen shot for error.
2p7gy891m07d.png
below is the screen shot of code, I could use AUTOMATION type variable for this code but in C# it will cause exception of type like dialog open, message box open etc. So I used DotNet var. May be I m wrong with code, please help me out.
8etdrvj80yzg.png

Thanks in advance.

Answers

  • ErictPErictP Member Posts: 164
    Maybe the same problem as in :Calling Rest API.

    Add the line: ServicePointManager.SecurityProtocol(SecurityProtocol.Tls12);
  • SuDSuD Member Posts: 102
    ErictP wrote: »
    Maybe the same problem as in :Calling Rest API.

    Add the line: ServicePointManager.SecurityProtocol(SecurityProtocol.Tls12);

    where to add, in C/AL or in C#. How can I add it in C# because API is calling from NAV code, or if you are talking about adding line in C/AL then what Dot Net var should I use.

    Thanks
  • miOnKeybmiOnKeyb Member Posts: 13
    By your c#-code you skills are at zero, you may need some training there, then you may understand the Exception-class and what a message means.
  • SuDSuD Member Posts: 102
    miOnKeyb wrote: »
    By your c#-code you skills are at zero, you may need some training there, then you may understand the Exception-class and what a message means.

    Bro I m not a C# developer, That's why I post this error here, If you know how to resolve this error then please let me know, Otherwise I don't need your suggestions.
Sign In or Register to comment.