Did you look at the Codeunits as I told you? If Yes, please ask more specifically about where you got stuck. If not, please note that a forum is not there to do the work for you, it is there to help you when you're stuck. A well asked question in a forum gives some indication as to whether you are lazy or stuck.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.
Answers
Please help.
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.
Please let me know if I need to provide more inputs.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.
Thanks a lot for the concept.
Sorry if I am too pressing, but an example will help me a lot.
https://rockwithnav.wordpress.com/2017/06/30/file-to-byte-conversion-client-to-server-move/
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
I will tryout the example and revert.
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.
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.
Really thankful to all of you for your help and push.
Resolved the issue with your help.
Grateful to all of you
Learning new skills is hard, especially in the beginning. Glad you overcame the hurdles an finished the task.