Create a PDF from base64binary after calling a SOAP web service

navbeginnernavbeginner 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

Best Answers

Answers

  • navbeginnernavbeginner Member Posts: 23
    Hello Experts,

    Please help.
  • lubostlubost Member Posts: 611
    What is a question/problem?
  • navbeginnernavbeginner Member Posts: 23
    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.
    Please let me know if I need to provide more inputs.
  • navbeginnernavbeginner Member Posts: 23
    Hi vaprog,

    Thanks a lot for the concept.
    Sorry if I am too pressing, but an example will help me a lot. :s
  • navbeginnernavbeginner Member Posts: 23
    Thanks a lot RockWithNAV!
    I will tryout the example and revert.
  • navbeginnernavbeginner Member Posts: 23
    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.
  • lubostlubost Member Posts: 611
    Communication with webservices is widely discussed, search forum.
  • navbeginnernavbeginner Member Posts: 23
    Hi Experts,

    Really thankful to all of you for your help and push.
    Resolved the issue with your help.
    Grateful to all of you :)
  • vaprogvaprog Member Posts: 1,116
    Assuming nomen est omen: congrats!

    Learning new skills is hard, especially in the beginning. Glad you overcame the hurdles an finished the task.
  • navbeginnernavbeginner Member Posts: 23
    Thanks all experts!
Sign In or Register to comment.