How to make available binary data via Web Service
 
            
                
                    d3dek                
                
                    Member Posts: 6                
            
                        
            
                    First of all I want say HELLO to everyone because I'm new here.
I'm also new to NAV and C/AL. What I try to accomplish is to make images available via Web Service.
So i create code unit etc. and my question is how can i return such binary data? Under Return Value window only suitable data type is Binary but i don't have idea how to use it. Moreover in C/SIDE Reference Guide i found information that Binary data type is obsolete.
I make some search via Google and I found that BigText can be used, but there is no such type under Return Value window.
I'm using Dynamics Nav 2009 R2.
                I'm also new to NAV and C/AL. What I try to accomplish is to make images available via Web Service.
So i create code unit etc. and my question is how can i return such binary data? Under Return Value window only suitable data type is Binary but i don't have idea how to use it. Moreover in C/SIDE Reference Guide i found information that Binary data type is obsolete.
I make some search via Google and I found that BigText can be used, but there is no such type under Return Value window.
I'm using Dynamics Nav 2009 R2.
0                
            Comments
- 
            BigText can not be used as a return value type. However, you can assign a bigtext var as parameter of a function and make that paramter "VAR" (so this parameter is passed by reference)
 Now you can fill you bigtext parameter with whatever you need. since you need to pass an image i assume this image is stored in a blob field in a table?
 So then you would need to write the data from the blob into a stream then write to the bigtext.
 I would recomend having a look at this solutions:
 http://blogs.msdn.com/b/freddyk/archive/2008/11/04/transferring-data-to-from-com-automation-objects-and-webservices.aspx
 http://kfuglsang.com/post/2011/08/09/Dynamics-NAV-2009-Binary-Data-via-Web-Services-Without-Specialized-COM.aspx
 BTW: If you don't want to use automation or com you could use dotnet interop and the StreamReader Class form the .Net Framework
 This will give you a string which you can assign to your BigText variable.
 Code would looke something like this:Item.CALCFIELDS(Item.Picture); Item.CREATEINSTREAM(YourStream); StreamReader := StreamReader.StreamReader(YourStream); BigTextVar.Write(StreamReader.ReadToEnd()); 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
- 322 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
