Options

Webservices: Calling Extension Codeunits from ClassicClient

SonGoten13SonGoten13 Member Posts: 44
edited 2011-11-28 in NAV Three Tier
Hey,

I am playing around with webservices a little bit, especially with calling them from Classic Client.
So i used the blogpost from freddy(http://blogs.msdn.com/b/freddyk/archive ... 9-sp1.aspx), and it works fine to call a Page or Codeunit Webservice within C/AL.

But i am struggeling with extension Codeunits. As they expect a record as the first parameter.
So in my example i am publishing the customer page and an extension codeunit with a function that takes a customer record.
When i look at the definition in http://localhost:7047/DynamicsNAV/WS/Page/Customer i see that webservices expects a string as parameter, which in C/AL is a record. I assume it uses some kind of recordID-ish string as i found out, that when i send a read statement at the customer page webservice i get back exactly what i need, as there is a <key> Tag, and when i use that as the parameter for my extension codeunit webservice call it works. In my example this looks like this for Cronus customer 10000:
<Key>16;EgAAAACJBTEwMDAw4;57010;</Key>
I tried around with recordID and recordRef but i couldn't find this string; the only lead i found was that maybe the timestamp from the sql-table has something to do with it, as in my example the timestamp is 0x0000000000001645 and 1645 is hex for 5701 ...

Anyone knows if it possible to get this Info within C/AL (without first call a read statement and get it from the response xml) ?

I know i could just use a normal codeunit and give all the pk fields as parameters and i have the same possibilities, but i am curious if it works also this way.

greetings

Comments

  • Options
    max_hlmax_hl Member Posts: 13
    Hey!

    Use a text variable as filter for the Customer table when you call the function of published codeunit and return xml formatted structure as BigText variable to caller.

    NAV Record variable cannot be passed as parameter to function call or it's the magic )
  • Options
    kinekine Member Posts: 12,562
    You can get the "bookmark" by code used in this article: http://blogs.msdn.com/b/freddyk/archive ... -of-3.aspx
    results.Bookmark := FORMAT(rec.RECORDID,0,10); 
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    SonGoten13SonGoten13 Member Posts: 44
    thx for that hint kine,
    unfortunately works only in RTC, not in Classic

    @max_hl
    I dont't get what you are trying to tell me here :?
  • Options
    kinekine Member Posts: 12,562
    Oh, I forgot that, that the original post is WS server, not client, thus running on 3tier... :oops:

    But the code looks like Base64 if you skip the first part...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.