用类型列表< T>呼叫客户端WCF服务. [英] Calling Client-Side WCF Service With Type List<Of T>
问题描述
我正在设计同时显示上传的多文件上传服务 每个文件的进度.
I am designing a multi-file upload service that also shows upload progress for each file.
如果我将WCF方法设计为SOAP合同,我会做 像这样的东西:
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);
但是,如何传递类型为"List<Upload>
"的参数"request"
当我从客户端(../upload.svc/
uploadpictures/" 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.
推荐答案
作为第二部分,您正在使用SOAP-这意味着,您不能仅从URL(REST风格)调用服务方法.您发布的内容意味着(../upload.svc/uploadpictures/"request").
You're using SOAP as you say yourself - which means, you cannot just invoke your service methods from the URL (REST-style), as the second part of your posting would imply (../upload.svc/ uploadpictures/"request").
您需要在SOAP中进行以下操作(假设您已经使用Visual Studio或svcutil
创建了客户端代理):
What you need to do in SOAP is this (assuming you've created your client side proxy using Visual Studio or svcutil
):
// create client side proxy, reading URI etc. from config
ServiceClient clientProxy = new ServiceClient();
List<Upload> _list = new List<Upload>();
// add your uploads - don't know what that is - just a filename? The actual
// contents of the file? That's up to you
_list.Add(..........);
var response = clientProxy.UploadMethod(_list);
马克
这篇关于用类型列表< T>呼叫客户端WCF服务.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!