Options

Use webservice to search in 2 tables

elwin68elwin68 Member Posts: 153
edited 2009-02-27 in NAV Three Tier
I want to search in NAV2009 through a webservice in 2 tables.
For Example: I set a filter at the field email in the customer table. Then I want to show the sales order from the found customer(s).

There are more possibilities to do this:
- Usage of 2 webservices so I can first search for the customer(s). With the outcome I search for the sales orders.
- Add the field email in the sales header table so I have 1 table to search in.

Is it possible to leave the tables as they are and use 1 webservice to do the trick?
Can a codeunit be used to extend the functionality of the page webservice? And how is this done?

Thanks in advance.

Answers

  • Options
    freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    If you write a codeunit with a method, which takes the customer record as the first parameter - and you expose this codeunit as a webservice with the same name as the Customer page - and NO check in published.

    Then you will have this method available on the customer page.

    but.... - you might not want to go with a page here - you might just want to expose a codeunit with a method, which returns a XMLPort returning the sales orders you are searching for - Pages might look like the easy way to go, but I think you often should consider whether the WS contract really is for CRUD purposes before just exposing the page.
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • Options
    elwin68elwin68 Member Posts: 153
    Thanks Freddy for your answer.
    What do you mean by returning the sales orders with a xmlport?
    Just export the sales orders with an xmlport to a xml file and then read the contents of xml file?
  • Options
    kinekine Member Posts: 12,562
    It means that you use XMLPort for creating the "Response" of the WebService... just search for weservice and xmlport...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    elwin68elwin68 Member Posts: 153
    thanks for the explanation.
    I have found the website and will look at it.
Sign In or Register to comment.