XML-Port Export of data - unbound to a specific table

JutJut Member Posts: 72
Hi everyone,

I try to develop a web-service based on XML-Ports that actually allows me to define in NAV what data actually will be published as a web-service - I mean the data will not always be retrieved from the same table but the source could differ based on a setup-table in NAV. Of course I could just manually create the xml-tree in a Codeunit in NAV and publish that codeunit. Yet, I would rather prefer to use XML-Ports to have a strongly typed interface. The question now is (and I have to admit that I have never actually used XML-Ports in NAV and could not find anything about this in the "Developers-bible") if I have a chance to define a XML-Port not to be bound to specific tables but e.g. to use a temporary-record variable instead so that the xml-port could then populate that temporary-table OnPreXMLPort and export that accordingly. Since this temporary table could be populated from various different NAV-tables based on a setup-table in NAV, that flexibility would certainly be of great help.

Thanks a lot in advance!
Jut

Comments

  • Vincent_VancalberghVincent_Vancalbergh Member Posts: 10
    You can't have strongly typed if it's dynamically set at run-time. Beware of making things too dynamic or you'll end up with a setup so complicated that it becomes a programming language of it's own!
    Senior Technical Consultant at Edan Business Solutions/Sphinx IT
    Owner of V-Kwadraat (see my blog about Programming and my feed about Gaming!)
  • David_SingletonDavid_Singleton Member Posts: 5,479
    I agree with Vincent, whilst it's technically possible to do what you are asking (XML ports are not bound to a table) you can easily create spaghetti bolognese.

    The better solution is to define a data structure that covers what you need, and create tables in Navision that replicate this structure, once you have the data structure defined, the rest becomes easy.
    David Singleton
Sign In or Register to comment.