The best thing you can do now, is download the final sidebar gadget from our book's web site (www.teachmenav.com), play with it (if you have Vista and Dynamics NAV 2009 installed), and then open up the source code contained within the gadget and take a look at how it's done. You'll also find some screenshots of the final gadget in all its glory.
The attached zip file contains these files...
File Name
Description
91350.fob
This Codeunit is used by the Vista sidebar gadget programming sample. The Codeunit must be imported, compiled and exposed as a Web service in order to use the samples.
91350.txt
Text version of 91350.fob.
Chapter 7 - Windows Vista Sidebar Gadget.rar
There are quite a number of steps to take the Vista sidebar gadget through to a final working solution. Rather than provide the finished version, I figured it would be better to provide the steps that I followed to get to where I was going. You need to de-compress this rar file and then run the default.html page. The Codeunit 91350 must be working and exposed as a Web service before you can play with these samples.
Hi David,
I tried your example with a german environment and I'm failing after testing the Codeunit 91350 with the Internet Explorer.
In the overview of all NAV services I can find the correct code unit but when I use it directly I get the following error:
Additionally, when I start the codeunit directly from the object designer the following window comes up:
I think data is missing :-)
I think you're right. I just updated the programming samples for the gadget to work on my Windows 7 machine with NAV 2009 SP1 and I only needed to put in the correct URL (new SP1 format) and remove the extra spaces from the SOAP call and everything worked (for the web page samples at least - I haven't tried the actual gadget yet).
If you don't have any approval documents it doesn't work - whoops. Try inserting a record in table 454 (you could use the system to do this by creating a document that requires approval form you or you could just type the data in).
Once you have data in the table for your approval it should work. I guess the gadget needs some more work!
I've just tried editing and installing the actuall gadget and it's the same story. As long as I have the correct URL, remove the blanks from the SOAP envelope and have some data, it works.
´Thank you for your fast answer. But everything you told me I did before and the error message shows an error at the parameters for one of the functions. when you say it works on your machine, I think there must be difficulties with the language perhaps a (ML)caption of an option field or something else. could it be, that the german environment doesn't match with the codeunit? Or with the XML Parser Automation you are using at the Globals?. When you have an entry in the table 454 and you start the codeunit 90350 from the object designer, what result is shown in the messagebox?
In the message box (when I have data) I get the XML Document that contains the records show in the message box.
I forgot to mention one of the steps I took when getting this working. I found the Codeunit 90350 did not compile and this was because the version of the the MSXML did not exist on my machine. I took a look in the Migration Management Codeunit to see which version was working correctly on my machine and found I need to replace Microsoft XML, v4.0 with Microsoft XML, v6.0. I did this for every variable that used the Microsoft XML automation (which was a lot but copy and paste made this less painful). Then my codeunit compiled OK. It sounds like this is the same problem for you.
I have attached a zip file with my new codeunit 90350 to the this post it contains the CU as txt and fob. Hopefully this will get you going again.
Cheers,
Dave.
Hi Dave,
many thanks for your advices. I had the same problem with XML, v.4.0 after updating with XML, v6.0 I went one step further ....
But I had another problem, I don't know why, but one of the function (getDocumentNames) in the codeunit 91350 was global and should have been marked as local. That was my main problem, because the webservice could not establish any approval entry record parameter.
After fixing it, everything is running well
Hallo Dave,
I don't know if this is a feature of SP1 of Nav2009, but the URL-Encoding of the company name is different on my PC (NAV2009 SP1). Instead of 'CRONUS_International_Ltd' it is 'CRONUS%20International%20Ltd'. So, the correct webservice-URL should actually be: http://localhost:7047/DynamicsNAV/ws/CRONUS%20International%20Ltd/Codeunit/Document_Approval
Apart of that, congratulations on the practical samples!
Respectfully,
Rumen F.
You're right, this is a feature of NAV 2009 SP1. The cool thing is you don't need to guess about the URL since it is just a URL-Escaped version of the company name.
You can find more details on Freddy's blog.
T tried tu do de book Samples for de chapter 7 but in step 1 y had this error:
The error is: a:System.Net.WebExceptionSoap message is invalid!Soap message is invalid!
Ad the only chage i make in the html file was:
var url = 'http://localhost:7047/DynamicsNAV/ws/CRONUSNAV2009SP1/Codeunit/Document_Approval';xmlHttpRequest.open("POST", url, false);xmlHttpRequest.SetRequestHeader("Content-Type", "text/xml");xmlHttpRequest.SetRequestHeader("SOAPAction", "urn:microsoft-dynamics-schemas/codeunit/Document_Approval:GetApprovalStatusTest");
Hi there nsaad1,
you are not the first person to have this problem. The book was written to work with the RTM release and most people are now trying this with NAV 2009 SP1 and unfortunately the programming samples that use Javascript to call NAV web services via SOAP no longer work. Don't worry though, the fix is quite straight forward.
If you take a look at this thread http://www.teachmenav.com/forums/t/59.aspx you will see the solution. The reason for the error is that the SOAP envelope now needs to be formatted to remove additional white spaces. Quite simple really.
Good luck with getting your solution working.