Basic Web Service Question...

New to NAV and trying to test the basic Web Service page and Codeunit features. I'm confused on how you link a specific code unit to an exposed page. I found documentation that indicates I should expose the page in Web Services (I've done this and connected to it) and then create the entry in Web Services for the Codeunit I want to use and assign the same Service Name to the Codeunit as the page I want to link it to and leave the Published flag turned off on the Codeunit.

I have done this however, if I look at the xlm for the SOAP Url for the page, shouldn't I see the Codeunits operations/elements included in the page data so I can access the Codeunits functionality when connected to the page from my developer? I can't see the Codeunit exposed at all.

Best Answer

Answers

  • archer89archer89 Member Posts: 337
    for creating an extension codeunit follow https://msdn.microsoft.com/en-us/library/dd338962(v=nav.90).aspx
    best regards
    Franz Kalchmair, MVP
    Alias: Jonathan Archer

    please like / agree / verify my answer, if it was helpful for you. thx.
    Blog: http://moxie4nav.wordpress.com/
  • MfgConceptsMfgConcepts Member Posts: 8
    Thank you for the information. That is the document I used to get to where I'm at now. The problem is, I can't tell how to know if the CodeUnit is available or not. I was thinking the Codeunit information would be available in the page so when I connect, the functionality would be available. I'm using a product called Magic to connect to the Web Service but I can't see how to implement the Codeunit. Can you tell me if the Codeunit should be in the Page XML or if it is separate?
  • kylehardinkylehardin Member Posts: 257
    Offering the codeunit as a web service is different from offering a Page. It can be one or the other. A Page gives you certain canned features so you don't have to write any code, whereas a codeunit lets you control everything (but you have to write everything).

    As for testing whether web services are available, you can use a web browser to do so.

    This will return a WSDL with the SOAP services currently being offered (modify to match your server and NST names):

    http://navserver.domain.local:7047/DynamicsNAV90/WS/CRONUS USA, Inc./Services

    And then you can test a particular SOAP offering with a more-specific URL. Inside of NAV, go to Web Services. The SOAP URL for each offered service can be tested in a web browser, and it will give you a list of exposed methods and properties.

    http://navserver.domain.local:8047/DynamicsNAV90/WS/CRONUS USA, Inc./Page/SalesOrder
    Kyle Hardin - ArcherPoint
  • MfgConceptsMfgConcepts Member Posts: 8
    Hmmm. Now I'm even more confused. The document link above indicates that you can tie a codeunit to a specific page by using the same Service Name in Web Services and that you don't publish the codeunit, you only publish the Page associated with the codeunit and that the codeunit becomes an additional option along with create/delete/modify on the page.

    For example, I want to post a purchase receipt. I should be able to publish the purchase order page and link Purch Post codeunit that I made available so that when I connect to the Purchase Order page, update the receipt quantity, I should have access to the codeunit to post the receipt.

    Not sure that is how it works but that is what I'm interpreting based on the document.

    If I publish the Purchase Order Page and separately publish the Purch Post Codeunit. How would executing the codeunit know what line to post on the PO?
  • KishormKishorm Member Posts: 921
    Hi MfgConcepts,

    You are correct in your understanding - what you are referring to are extension codeunits for web services and from your description it looks like you are doing it correctly.

    The one thing you need to check is that your functions in the codeunit are global - if you are using NAV 2016 then they will be local as default and will not be visible externally (outside of the codeunit).

    Regards
    Kishor
  • MfgConceptsMfgConcepts Member Posts: 8
    Kishor,

    In the case where I am using predefined 2016 NAV pages and codeunits would it still require me to edit the codeunit to make them visible externally? Also, can any codeunit be an extention to a page? Again, talking specifically about the ones setup in NAV by default.

    I'm also confused on the licensing for modification and use of codeunits and pages by my customers. Does the licensing for codeunits and pages refer to any codeunits and pages or just custom/modified codeunits and pages. For example, the Extended Pack indicates it has a "Configuration" that includes 10 codeunits and 100 pages... Confused on what that really means. Does that mean I can only expose and use 10 codeunits (predefined) before paying for more or does that mean I can use any of the predefined codeunits but if I want to create my own or customize any, I can only do that to 10 before I have to purchase additional codeunit licencing?

    Sorry for all the questions. Thank you for your help.
Sign In or Register to comment.