How to create webservice question

donit
Member Posts: 24
Hi,
It’s NAV 2009 6 but still Classic Client. I’d need to create a webservice to enter/modify/delete data in a Contact and Contact Mailing Group tables from a web page. The web page will have a person name, email, and mail group codes that match with NAV entries. I’ve read the following nice articles
http://www.kauffmann.nl/blog/index.php/ ... ervices-1/
and others and it seems as it shouldn’t be that difficult to create a codeunit with INSERT, MODIFY, DELETE statements and register it as a webservice. The codeunit however should return an integer only to a web page to show a transaction success, e.g. EXIT(1). If I need to return a table data then I’d use a root element then a table element then a field element, etc. But, I’m wondering if I need to return an integer only then how the XMLPort could look like or I could possibly use some different approach for it not an XMLPort.
Probably, I don't need an XMLPort at all as I could use a codeunit with a function and parameters. I'd register this codeunit as a webservice and refer to a method from a webpage passing parameters.
Thanks
It’s NAV 2009 6 but still Classic Client. I’d need to create a webservice to enter/modify/delete data in a Contact and Contact Mailing Group tables from a web page. The web page will have a person name, email, and mail group codes that match with NAV entries. I’ve read the following nice articles
http://www.kauffmann.nl/blog/index.php/ ... ervices-1/
and others and it seems as it shouldn’t be that difficult to create a codeunit with INSERT, MODIFY, DELETE statements and register it as a webservice. The codeunit however should return an integer only to a web page to show a transaction success, e.g. EXIT(1). If I need to return a table data then I’d use a root element then a table element then a field element, etc. But, I’m wondering if I need to return an integer only then how the XMLPort could look like or I could possibly use some different approach for it not an XMLPort.
Probably, I don't need an XMLPort at all as I could use a codeunit with a function and parameters. I'd register this codeunit as a webservice and refer to a method from a webpage passing parameters.
Thanks
0
Comments
-
donit wrote:Hi,
I could use a codeunit with a function and parameters. I'd register this codeunit as a webservice and refer to a method from a webpage passing parameters.
Thanks
I would use this approach...~Rik~
It works as expected... More or Less...0 -
Troubles In Paradise wrote:donit wrote:Hi,
I could use a codeunit with a function and parameters. I'd register this codeunit as a webservice and refer to a method from a webpage passing parameters.
Thanks
I would use this approach...
Thank you so much. I cannot find a button as on other forumes to mark the answer as a solution.
Please, also advise if you know I'm going to create a simple code using a gloabal record variable using IF .. .GET THEN EXIT(-1) // meaning already exists returning the -1 to a webpage
otherwise INSERT(TRUE) EXIT(1) //meaning entered returning the 1 to a webpage
for the Contact table and then for the contact Mailing Group.
Should I do any other validations in the function?
Or it'd be better to copy a code from the tables triggers? But I don't probably have access due to a license.0 -
You don't need to use IF GET THEN EXIT(-1). The INSERT function also return boolean
Trigger validations should work just fine.-Mihail- [MCTS]0 -
mihail_kolev wrote:You don't need to use IF GET THEN EXIT(-1). The INSERT function also return boolean
Trigger validations should work just fine.
Thank you so much for your response, Mihail.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