Can XMLPort works for dynamic XML response ?

bilalrai
bilalrai Member Posts: 50
Hi guys,
I am stuck in a problem. I am getting XML response from a webservice in NAV. I have created XMLPort for importing data from XML response to NAV table. It works fine when the response has all the tags that are defined in the structure of XMLPort but when anyone of the tag is missed in response it throws an error. Is there a way that when a tag is missed in XML response NAV just skip it and import data from other tags?

Answers

  • vaprog
    vaprog Member Posts: 1,163
    Setting the MinOccurs property to Zero should do the trick.
  • bilalrai
    bilalrai Member Posts: 50
    Thanks @vaprog but I have already tried that option in properties.
  • Juhl
    Juhl Member Posts: 724
    Load it into XDocument and go through it manually.
    Follow me on my blog juhl.blog
  • vaprog
    vaprog Member Posts: 1,163
    bilalrai wrote: »
    Thanks @vaprog but I have already tried that option in properties.

    In this case you need to update NAV to a newer version or build; or follow @Juhl's advice.
  • devdrone
    devdrone Member Posts: 14
    vaprog wrote: »
    Setting the MinOccurs property to Zero should do the trick.

    This is the only legit trick. Set this property to all the nodes.