Connect NAV Web Service From JavaScript for Call Function CU

johannajohanna Member Posts: 369
edited 2011-08-03 in NAV Three Tier
Dear all,

I have to call function with some parameters in codeunit using NAV Web Service from Javacript.
Could you can help me to give me an example to do that? Thanks before.
Best regards,

Johanna

Answers

  • kinekine Member Posts: 12,562
    Search the internet... it is easy to find the answers... :-) http://blogs.msdn.com/b/freddyk/archive ... -java.aspx
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • johannajohanna Member Posts: 369
    Thanks Kine,

    I have search in internet and read Freddy's blog post, but I cannot find how to connect NAV Web Service From Javascript to Call Function with some Parameter in Codeunit. Freddy's blog post just mention how to read data from page that is already published (http://blogs.msdn.com/b/freddyk/archive/2010/01/21/connecting-to-nav-web-services-from-javascript.aspx).
    Thanks for your link, but I want to connect from Javascript, not Java. If you have any idea or link, please let me know. Thanks again.. :)
    Best regards,

    Johanna
  • kinekine Member Posts: 12,562
    I think the basics will be same like when calling WS from NAV. You need to create correct SOAP request and send it. How the request looks like is easy to find using fiddler webdebugger and e.g. some sample application created in Visual Studio or by sending the request by some tool (e.g. WCFTestClient from Visual Studio). You can create the SOAP through XMLDom or through other libraries.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • johannajohanna Member Posts: 369
    Hi Kine,

    Thank you so much! :)
    Fiddler web debugger is awesome and helps me a lot.. ^^
    I using function from codeunit as using page.. I made a mistake about the urn that is case sensitive.. Thank you so much..
    Best regards,

    Johanna
  • kinekine Member Posts: 12,562
    You are welcome! Do not forget - in most cases, you are not alone solving similar problem, thus you can expect that there will be tool which helps you, made by another guy solving similar problem before you... :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • johannajohanna Member Posts: 369
    Okay, thank you so much Kine :D
    Best regards,

    Johanna
  • johannajohanna Member Posts: 369
    Dear Kine,

    I have tried to add function in page Customer Card and table Customer. Then, I have published the page Customer Card. But, my new function is not available in web service of customer card page. Is it normal? Whether I have to create function only in codeunit to publish that function in web service? Thanks..
    Best regards,

    Johanna
  • kinekine Member Posts: 12,562
    Yes, you need to use "extending" codeunit to publish functions for some page...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • johannajohanna Member Posts: 369
    Okay, thank you for your informations :)
    Best regards,

    Johanna
Sign In or Register to comment.