Create a PDF from base64binary after calling a SOAP web service

navbeginner
Member Posts: 23
Hi experts,
Can anyone please let me know how to call a asmx web service passing two parameters. The web service call returns a base64binary stream, which I convert into pdf and save at a predefined location
Can anyone please let me know how to call a asmx web service passing two parameters. The web service call returns a base64binary stream, which I convert into pdf and save at a predefined location
0
Best Answers
-
You can use codeunit 1290 to access the SOAP web service. You might have to add a SOAPAction header, change the content type and add http authentication.
You can find an example of how it is used in Codeunit 248.
When you retrieved the answer, extract the pdf data stream from the xml, decode it using DotNet and write it to a file. Search for what you need here in the .NET Framework documentation.
5 -
See if this helps you -
https://rockwithnav.wordpress.com/2017/06/30/file-to-byte-conversion-client-to-server-move/Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/5 -
navbeginner wrote: »But the issue I am facing is calling the web service by passing the parameters and receiving the byte string.
I am really sorry but I am completely new to web service, so if you can provide example of calling an asmx web service and receive the byte string which may precede the above code it will help me a lot.
And as lubost said, there are many more examples on the net, how to access various kinds of web services in various ways. Just search.
6
Answers
-
Hello Experts,
Please help.0 -
What is a question/problem?0
-
Hi lubost,
Thanks for asking.
I have a series of steps which achieve in NAV. Below I have mentioned them serially.- I want to call an external asmx we service from NAV by providing couple of parameters.
- Then the web service will return base64binary string.
- After I receive the string I want to save the data as a file in pdf.
0 -
You can use codeunit 1290 to access the SOAP web service. You might have to add a SOAPAction header, change the content type and add http authentication.
You can find an example of how it is used in Codeunit 248.
When you retrieved the answer, extract the pdf data stream from the xml, decode it using DotNet and write it to a file. Search for what you need here in the .NET Framework documentation.
5 -
Hi vaprog,
Thanks a lot for the concept.
Sorry if I am too pressing, but an example will help me a lot.0 -
See if this helps you -
https://rockwithnav.wordpress.com/2017/06/30/file-to-byte-conversion-client-to-server-move/Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/5 -
Thanks a lot RockWithNAV!
I will tryout the example and revert.0 -
Hi RockWithNAV!
I tried out with the code mentioned in the blog link as mentioned below
Byte:=Convert.FromBase64String(FileInBigText); //FileInBigText includes scanned file
MemoryStream:=MemoryStream.MemoryStream(Byte);
TempBlob.DELETEALL;
TempBlob.INIT;
TempBlob.Blob.CREATEOUTSTREAM(OutStream);
MemoryStream.WriteTo(OutStream);
TempBlob.INSERT;
File.CREATE(FilePath); //Filepath Includes Path + Name + FileType
File.CREATEOUTSTREAM(FileOutStream);
TempBlob.Blob.CREATEINSTREAM(FileInStream);
COPYSTREAM(FileOutStrm,FileInStream);
File.CLOSE;
But the issue I am facing is calling the web service by passing the parameters and receiving the byte string.
I am really sorry but I am completely new to web service, so if you can provide example of calling an asmx web service and receive the byte string which may precede the above code it will help me a lot.0 -
Communication with webservices is widely discussed, search forum.0
-
navbeginner wrote: »But the issue I am facing is calling the web service by passing the parameters and receiving the byte string.
I am really sorry but I am completely new to web service, so if you can provide example of calling an asmx web service and receive the byte string which may precede the above code it will help me a lot.
And as lubost said, there are many more examples on the net, how to access various kinds of web services in various ways. Just search.
6 -
Hi Experts,
Really thankful to all of you for your help and push.
Resolved the issue with your help.
Grateful to all of you0 -
Assuming nomen est omen: congrats!
Learning new skills is hard, especially in the beginning. Glad you overcame the hurdles an finished the task.0 -
Thanks all experts!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
- 321 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