Web Services Black Belt: consuming NAV web services using pure C/ALHave you ever needed to connect to the Web services of one NAV instance from another one?If so, I bet that the approach was something like this: you created a . Can I Play Gamecube Games On Wii U . NET class where you defined a Web or Service reference to the target instance, and then you consumed that .NET class using . Microsoft Dynamics NAV is an enterprise resource planning (ERP) app from Microsoft. The product is part of the Microsoft Dynamics family, and intended to assist with. Play. Microsoft Dynamics NAV ERP. Diastasys is an official Microsoft Gold Enterprise Resource Planning Partner. A distinction which ascertains the high-level know-how. NET Framework interoperability. It was kind of clumsy, inflexible, but it worked. How cool would it be if you could do something like this: WITH Web. Service DO BEGIN CONNECT(‘http: //localhost: 7. Dynamics. NAV7. 0/WS/CRONUS%2. International%2. 0Ltd/Page/Customer’); INIT; SETVALUE(‘Name’,’Test Customer’); SETVALUE(‘Blocked’,Cust. Blocked: :Ship); SETVALUE(‘Credit_Limit_LCY’,1. CREATE; MESSAGE(‘I just created Customer No. NAV instance.’,GETVALUE(‘No’)); END; As a matter of fact, you can write something like that. You can write exactly that. And it compiles, runs, and accomplishes exactly what you expect it to do. The most beautiful thing, you don’t need to write a single line of code in Visual Studio, or deploy any external dependencies – it uses pure C/AL, and works equally well in NAV 2. NAV 2. 01. 3. The only thing you need is a simple codeunit that you can download from Mibuso. If you missed the link in the previous sentence, then click here. Development Environment Introduction in NAV 2016 training aims to familiarize participants with development environment of Microsoft Dynamics NAV 2016.I wrote that codeunit as a part of the demo I presented last Wednesday at Mibuso NAV Tech. Days 2. 01. 2 in Antwerp, and as promised – I am making the code available for you to use. This simple codeunit does no magic, it simply harnesses the power of the features built into the . NET Framework. It builds the proxy class and compiles it on the fly, and then uses reflection to instantiate objects, set properties, and call methods to allow you to interact with any NAV page web service. Before you can consume a NAV page Web service from C/AL you do not need to know anything about the service, except for its URL. If it’s a page web service, you can use it to read, create, update, and delete data in another NAV instance, simply using C/AL. At this stage, it supports the following page web service functions: Read Read. Multiple Create Create. Multiple Update Update. Multiple Delete Right now, I am providing no documentation for it, but I believe it should not be difficult to figure out what it can do by following these couple of examples. Creating a customer. That’s the example above. Just declare a variable named Web. Service of type Codeunit 5. Iterating through a set of customers read, with a filter applied. WITH Web. Service DO BEGIN CONNECT(‘http: //localhost: 7. Dynamics. NAV7. 0/WS/CRONUS%2. International%2. 0Ltd/Page/Customer’); SETFILTER(‘Balance_LCY’,’> 0′); SETFILTER(‘Name’,’A*’); IF READMULTIPLE THEN REPEAT MESSAGE(‘Customer %1 %2 has balance of %3’,GETVALUE(‘No’),GETVALUE(‘Name’),GETVALUE(‘Balance_LCY’)); UNTIL NEXT = 0; END; EXIT; Updating an item. WITH Web. Service DO BEGIN INIT; SETVALUE(‘No’,’1. READ; SETVALUE(‘Description’,’Bicycle 2’); UPDATE; END; Creating a purchase order from a sales order. WITH Web. Service DO BEGIN CONNECT(‘http: //localhost: 7. Dynamics. NAV7. 0/WS/CRONUS%2. International%2. 0Ltd/Page/Purch. Order’); INIT; SETVALUE(‘Buy_from_Vendor_No’,Rec."Sell- to Customer No."); Sales. Line. SETRANGE("Document Type",Rec."Document Type"); Sales. Line. SETRANGE("Document No.",Rec."No."); IF Sales. Line. FINDSET THEN REPEAT NEWLINE; SETLINEVALUE(‘Type’,FORMAT(Sales. Line. Type)); SETLINEVALUE(‘No’,FORMAT(Sales. Line."No.")); SETLINEVALUE(‘Quantity’,Sales. Line. Quantity); UNTIL Sales. Line. NEXT = 0; CREATE; MESSAGE(‘Purchase Order No. GETVALUE(‘No’)); END; I’ll be updating the functionality of this codeunit and uploading a more comprehensive version, as I find time to do this. This post is a series of posts where I’ll present most of the stuff I talked about at NAV Tech. Days 2. 01. 2, and expand those topics into the areas that I either had to leave out due to time constraints, or that I thought were not as interesting as those that I chose to put into the presentation. Please, let me know how you like this small gadget. Web Services – Gunnar's Blog. But first… Registration for NAV Tech. Days 2. 01. 7 have been opened. I will do a workshop on web services and json. I will be using both C/AL and AL with VS Code in this workshop. Make sure to register for the conference and if possible go to.. Continue reading »May 1. Gunnar Gestsson. Solutions. Comments. In my post about Json and Rest web services I showed how to use the standard Codeunit no. Today I was asked to do this in NAV 2. I must admit, I forgot that this Codeunit was not available in NAV.. Continue reading »January 2. Gunnar Gestsson. Solutions. . No Comment. Assisted Setup and Permissions.But first lets look at the Extension Management Codeunit. I want to store the app. Id in my Extension. This app. Id is used in several tables in my tenant. This app. Id must always be the same for this solution even if the solution is.. Continue reading »December 9, 2. Gunnar Gestsson. Solutions. Comments. One of my most popular blog entry is the one about Json. I have also had some questions outside this website about this topic. This week I got a task. We need to communicate with a payment service that uses REST web services and Json.. Continue reading »December 1, 2. Gunnar Gestsson. Solutions. Comments. Asynchronous methods are very useful for web services. To be able to start a process with one method and then check the status with another opens a lot of possibilities. There are two known patterns in NAV that support asynchronous methods; one is to use the STARTSESSION.. Continue reading »March 1. Gunnar Gestsson. How- To's. Comments. I have been using SOAP services over the last years. Only recently the RESTful web services have become more and more popular in my integration work. Wikipedia says: In computing, Representational State Transfer (REST) is a software architecture style for building scalable web services. REST gives.. Continue reading »September 7, 2. Gunnar Gestsson. How- To's. Comments. I just came back from three weeks vacation yesterday. During my vacation I had made a decision to implement Tcp Port Sharing for the Instance Administration tool used in Advania Azure. Early last year I published a function that uses the sc. NAV.. Continue reading »August 1. Gunnar Gestsson. How- To's. Comments. Increasingly we are using Web Services to communicate between NAV companies. In a production environment these communication is usually secured by the SSL standard. When the communication is sent over the Internet I would recommend that a secure ping be added before every communication to.. Continue reading »October 7, 2. Gunnar Gestsson. How- To's. No Comment. Open Data Protocol (OData) is a data access protocol initially defined by Microsoft. In NAV 2. Microsoft first added a support for OData. On the Developer Network Microsoft has a few walk- throughs aimed to get us started in using both SOAP and OData web services.. Continue reading »September 3, 2. Gunnar Gestsson. How- To's. Comments. Yesterday I suggested to Microsoft an enhancement to the permission functionality. That was an informal suggestion so I logged into Microsoft Connect and added a formal suggestion. In table 2. 00. 00. Permission we can assign permission to objects. In the Classic Client we had the possibility to.. Continue reading »February 2. Gunnar Gestsson. Activity.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |