Calling Client-Side WCF Service With Type List<Of T>

Discussion in 'ASP .Net Web Services' started by pbd22, Oct 20, 2009.

  1. pbd22

    pbd22 Guest

    Hi.

    I am designing a multi-file upload service that also shows upload
    progress for each file.

    If I was to design my WCF method as a SOAP contract, I would do
    something like this:

    var request = IService.UploadMethod(List<Upload> request);

    But, how do I pass the parameter ""request"" of type "List<Upload>"
    when I am calling the method from the client (../upload.svc/
    uploadpictures/""request"")?

    Help appreciated, thanks.
    pbd22, Oct 20, 2009
    #1
    1. Advertising

  2. pbd22

    Mr. Arnold Guest

    "pbd22" <> wrote in message
    news:...
    > Hi.
    >
    > I am designing a multi-file upload service that also shows upload
    > progress for each file.
    >
    > If I was to design my WCF method as a SOAP contract, I would do
    > something like this:
    >
    > var request = IService.UploadMethod(List<Upload> request);
    >
    > But, how do I pass the parameter ""request"" of type "List<Upload>"
    > when I am calling the method from the client (../upload.svc/
    > uploadpictures/""request"")?
    >
    > Help appreciated, thanks.


    I would assume Upload would just be a string of the filepath to upload.

    On the client-side it would be this.

    var requests = new List<String>();

    requests.Add(filepath);

    var cleint = new WCFservice()
    client.Upload(requests);
    client.close();


    On server-side it would be this.

    UploadMethod(List<String> requests)

    foreach(var request in requests
    {

    unloadpic.path = request;

    }






    __________ Information from ESET NOD32 Antivirus, version of virus signature database 4524 (20091019) __________

    The message was checked by ESET NOD32 Antivirus.

    http://www.eset.com
    Mr. Arnold, Oct 20, 2009
    #2
    1. Advertising

  3. pbd22

    pbd22 Guest

    On Oct 19, 8:51 pm, "Mr. Arnold" <MR. > wrote:
    > "pbd22" <> wrote in message
    >
    > news:...
    >
    > > Hi.

    >
    > > I am designing a multi-file upload service that also shows upload
    > > progress for each file.

    >
    > > If I was to design my WCF method as a SOAP contract, I would do
    > > something like this:

    >
    > > var request = IService.UploadMethod(List<Upload> request);

    >
    > > But, how do I pass the parameter ""request"" of type "List<Upload>"
    > > when I am calling the method from the client (../upload.svc/
    > > uploadpictures/""request"")?

    >
    > > Help appreciated, thanks.

    >
    > I would assume Upload would just be a string of the filepath to upload.
    >
    > On the client-side it would be this.
    >
    > var requests = new List<String>();
    >
    > requests.Add(filepath);
    >
    > var cleint = new WCFservice()
    > client.Upload(requests);
    > client.close();
    >
    > On server-side it would be this.
    >
    > UploadMethod(List<String> requests)
    >
    > foreach(var request in requests
    > {
    >
    > unloadpic.path = request;
    >
    > }
    >
    > __________ Information from ESET NOD32 Antivirus, version of virus signature database 4524 (20091019) __________
    >
    > The message was checked by ESET NOD32 Antivirus.
    >
    > http://www.eset.com


    Can you do that? List<Of T> is a .NET Type, isn't it? How can you use
    it in JavaScript? I just tried this and it didn't work. Also, how can
    you instantiate
    new WCFservice() in JS? I must be missing something here.
    Illumination please?
    pbd22, Oct 20, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?R3JlZw==?=

    2.0 Framework calling WCF service.

    =?Utf-8?B?R3JlZw==?=, Apr 15, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    532
    =?Utf-8?B?R3JlZw==?=
    Apr 15, 2007
  2. Simon
    Replies:
    0
    Views:
    992
    Simon
    Oct 13, 2009
  3. Cindy Lee
    Replies:
    1
    Views:
    2,066
    Mr. Arnold
    Mar 19, 2010
  4. Greg

    2.0 framework calling WCF service

    Greg, Apr 15, 2007, in forum: ASP .Net Web Services
    Replies:
    5
    Views:
    231
    Cowboy \(Gregory A. Beamer\)
    Apr 23, 2007
  5. Curt K
    Replies:
    3
    Views:
    440
    John Saunders [MVP]
    Jun 15, 2007
Loading...

Share This Page