Solved

sending an exe over a webservice

Posted on 2004-10-29
164 Views
Last Modified: 2012-05-05
I currently have a .Net dll that calls a web service and is passed back a string.   Both are working fine.  I would like to change the web service to pass back an exe file instead..  

How do I pass back an exe from a web service?

Thanks,

Paul
0
Question by:waggert
    6 Comments
     
    LVL 96

    Expert Comment

    by:Bob Learned
    What is the big picture here?  Why would you want to use a web service for this?

    Bob
    0
     

    Author Comment

    by:waggert
    There are remote machines around the country that have specific versions of sql db's.  There's a local process that when kicked off it checks to see if there's a later version of the db available.  If so, they hit a web service providing their current version as an int parameter.  The web service then constructs a custom .net executable that will update the client's db according to whatever version they are currently on.

    So, there are almost an endless number of possible version to version update exe's because the local process is kicked off by the user and thus random.. Ex. 1 to 2, 1 to 3, 2 to 40, whatever.. so those exe's need to be created on demand, programmatically, based on the client's needs.

    Currently, the web service is set up to return a custom sql string to update the client's db.  However, I just realized that I could have a .net exe do the same thing which would be much cleaner and eliminate a lot of code.  The problem now is just figuring out how to return an exe to the client via web service..

    Thanks,

    Paul
    0
     
    LVL 15

    Accepted Solution

    by:
    You can send it as a byte array.

    Imports System.IO

    Dim path As String = "c:\path\to\file.exe"
    Dim fs As New FileStream(path, FileMode.Open)
    Dim br As New BinaryReader(fs)
    Dim bytes(fs.Length) As Byte

    bytes = br.ReadBytes(fs.Length)

    br.Close()
    fs.Close()

    At this point you would need to use a BinaryWriter to write the byte array back into a file.
    0
     

    Author Comment

    by:waggert
    k, thanks Timbo, I will try that.

    Paul
    0
     
    LVL 96

    Expert Comment

    by:Bob Learned
    0
     

    Author Comment

    by:waggert
    Thanks Timbo, works like a dream.. I had no idea it would be that easy.. .Net is awesome..

    Thanks TLO, for your help as well.. Although the Smart Client updates won't work for this specific project I will most likely use them for others.. One more reason .Net is great.. :-)

    Thanks!

    Paul
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Cisco Complete Network Certification Training

    If you’re an IT engineer or technician, it's time you take your career to the next level. This elite training bundle is brimming with all of the information you need to learn to sit for Cisco CNNA, CCNP, and CCENT certification exams.

    Suggested Solutions

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
    Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now