I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Plz U

A Member? Please Login  
type your username and password to login
Date: October 06, 2008, 10:17 PM
246876 members and 145796 Topics
Latest Member: timeless
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Programming  |  I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Plz U
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Plz U  (Read 271 views)
luckyCO
I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Plz U
« on: December 19, 2007, 11:43 AM »

I want to design a webservice that can enable me send data to and from client machine. I sed code below but it was giving me errors. I changed FileStream to StreamWriter and StreamReader, it complained about using C drive since I don't have access to it             Dim fs1 As New FileStream("C:\" & fo.Name, FileMode.Create).

When I changed  Dim fs1 As New FileStream("C:\" & fo.Name, FileMode.Create) to dim fs1 as new StreamWriter(path & fiename) and it worked but when I open the file it gives me strange xters.

Please help me look at the code below and suggest possible solutions if not a new idea.

Again it there anyway I could know scanners connected to my computer?

Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.IO
<WebService(Namespace:="http://mysite.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> <System.Serializable()> _
Public Class Service
    Inherits System.Web.Services.WebService

    <WebMethod()> _
        Public Function FilePosted(ByVal Filename As String) As String


        Try
            Dim path As String = Context.Server.MapPath("~/")
            Dim fo As New FileInfo(Filename)
            Dim fs As New FileStream(Filename, FileMode.Open)

            Dim fs1 As New FileStream("C:\" & fo.Name, FileMode.Create)
            Dim nBytes As Integer = fs.Length
            Dim ByteArray(nBytes) As Byte


            Do While Not fs.Read(ByteArray, 0, nBytes) = 0
                fs1.Write(ByteArray, 0, nBytes)
            Loop

            fs1.Dispose()
            fs.Dispose()

            Return "Success"

        Catch ex As Exception
            Return "Failed"

        End Try


    End Function



End Class
Kobojunkie
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Please You
« #1 on: December 19, 2007, 05:01 PM »

Go to www.Asp.net ,  Sign up and post your code in the appropriate forum,  to get answers, 
Gridlock (m)
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. P
« #2 on: December 20, 2007, 03:16 PM »

You file contains control xters (naturally), so you need to "protect" the data being transferred. Try encoding the file with Base64 encoding, that will allow you to transfer it as a string over regular HTTP. When it gets to the other end, it can then be decoded. I have written a C#/.NET app that retrieves/sends peoples pictures (JPEG files) over a webservice.
luckyCO
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Please You
« #3 on: December 21, 2007, 11:46 AM »

Please can you help me with some part of the code of all such that I will modify it to suit my need. Thanks
Kobojunkie
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Please You
« #4 on: December 30, 2007, 06:41 PM »

Did you ever figure out what the problem was??
luckyCO
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. P
« #5 on: January 07, 2008, 03:51 PM »

I tried my best but I still get the same error response.
Can anybody help me out?
Kobojunkie
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Please You
« #6 on: January 08, 2008, 07:11 PM »

luckyCO
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Please You
« #7 on: January 19, 2008, 01:28 PM »

Thanks so much I will go through it. I will let you know whether if it solves my problem.

Must I use credentials before calling my web services?
Kobojunkie
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Please You
« #8 on: January 19, 2008, 09:01 PM »

Nope
luckyCO
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Please You
« #9 on: January 21, 2008, 01:50 PM »

Do u know the funny aspect of it, if I tested the webservices on its own its works but if I refrence it it iwll not.
Still batlling about it, because I need what I will use to transport file  from on system to another without sharing the folder.
I will aprreciate any of ur contributions.
I ve gone to the site but don't get much.
Kobojunkie
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Please You
« #10 on: January 21, 2008, 10:37 PM »

Reponse,  you can't access the client machine to force a file upload due to security restrictions.
The client needs to explicitely select and upload the file.
luckyCO
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Please You
« #11 on: January 24, 2008, 09:48 AM »

So I can't write a web service that can easily allow my use client machine, pass the filename and it wil go straight to the server?
I think that should be possible that is what compound to my problem.

I need to reference the class from another client to enable me transfer files.

I still believe that this is way out.
Kobojunkie
Re: I Need A Class Tha Can Transfer Files Using Webservice On Client Machines. Please You
« #12 on: January 25, 2008, 11:42 PM »

Response :

you can't,

You could try an ActiveX installed on the client, or even better would be an exe/service installed on the client.

But without somethign installed on the client you can't force the upload of a client file.
 Defend Your Programming Language  Anything On Erp And Sap  Can You Write In System Language  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 
Google
 
Web www.nairaland.com
Sections: TV/Movies (2) Music/Radio (2) Celebrities Job Talk Jobs/Vacancies (2) Career Talk Romance Books Politics Sports Fashion Travel
Health Schooling Religion General(2) Business Webmaster Programming Computers Phones Cars & Trucks

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.