I am looking for a way to send a file with a Navision CodeUnit to a website (preferably a custom WebService). After searching through these great forums I found many posts explaining how to contact a WebService from Nav to send ordinary data, however the files I wish to transfer usually are images (.GIF, .JPG, .PNG), compressed archives (.RAR, .ZIP), documents (.PDF, .DOC(X)), spreadsheets (.XLS(X)), etc. of up to 8MB each. I am a fair C# programmer but my Navision knowledge is quite limited.
Here is my situation as short as possible:
1. Someone makes a support-call in Navision and adds attachments to it on their own server (the attachments are saved on their own network drive, the path to the file is stored in Nav).
2. A call can then be transfered to our WebService (which was created in C#) and the call is duplicated within our own Navision database.
3. After the call was created I wish to send their attachments to our webservices too, but I require some assistance with getting this part right.
After searching the forums I found this post ("Re: how to put a jpg file into a xml file by xmlport ?")
and after a few minutes of trying to understand this code, I figured it gets me into the right direction but it is incomplete (some declarations such as Trans
are missing, the namespace SOAP does not appear to be defined, etc.) and I really can't figure out the purpose of some of the functions. Where does Convert2binary
do it's encoding? How does the receiving WebService look like? What does the second parameter of SendSOAP(URL,URItemp+Action,GetResult) ;
Well anyway, disregarding the above example, what method would be best to transfer one or more file(s) accessible from within Navision (smaller than 8MB) to our website, and how to do that within Navision? Is there a different (better) method then WebServices?
Does anyone have a working CodeUnit they are willing to share?
How to a) open a file, b) encode it with base64 and then c) send it to a WebService? (I basically know the answer to c.)
Thanks in advance for all your help.Edit:
We all use Classic 2009 clients, so ADDTEXT as suggested in this post