Webservices: Calling Extension Codeunits from ClassicClient

SonGoten13
Member Posts: 44
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
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
0
Comments
-
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 )0 -
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);
0 -
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 :?0 -
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...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions