Options

How to Publish Tables (50000) series as Web Service

ChessExpertChessExpert Member Posts: 103
edited 2009-01-22 in NAV Three Tier
Hello there Experts.

I have a custom table e.g.
Table ID # = 50000
Name = District

that I would like to add to "Web Services" (Form#810).

Problem: The problem is, when I open the "Lookup" for "Object ID", my custom table is not showing on the list.

Can you please advise on what to do for me to expose those custom tables.

Once again, thank you experts.

Answers

  • Options
    ScarecrowScarecrow Member Posts: 5
    Hi ChessExpert,

    You cannot expose tables directly as a web service. You can only expose Codeunits and Pages.

    The answer is to create a page in the 50000 range using the Table as its source.

    You can then expose the page as a web service which will give you access to insert, read, delete or update the table.

    Regards,

    Scarecrow
  • Options
    ChessExpertChessExpert Member Posts: 103
    Hello there, thank you for your reply.
  • Options
    ChessExpertChessExpert Member Posts: 103
    I am able to get this working.

    Note: ThatI have to refresh my web reference from time to time and also restart the "NAV Business Web Service".

    Thanks.
  • Options
    ScarecrowScarecrow Member Posts: 5
    Hi ChessMaster,

    The error you are seeing indicates that you need to flush the object cache. I see this in the RTC also if you make changes to tables and don't restart the services.

    I would suggest restarting both the web service and service tier services and try again.

    The code snippet you supplied looks right.

    I whipped up a test Page of type "Card" and built a quick Vb console app which works fine with a custom page in the 50000 range.
    Module Module1
        Sub Main()
            Dim ws As New WebRef1.Test_Service
            ws.UseDefaultCredentials = True
            ws.Url = "http://localhost:7047/DynamicsNav/WS/GreatFoods/Page/Test"
            Dim flt(0) As WebRef1.Test_Filter
            Dim objRet(5) As WebRef1.Test
            objRet = ws.ReadMultiple(flt, "", 6)
            Dim i As Integer
            For i = 0 To 5
                Console.WriteLine("Category Number: " + objRet(i).Category)
            Next
            System.Threading.Thread.Sleep(2000)
        End Sub
    End Module
    

    Regards,

    Scarecrow
Sign In or Register to comment.