문제

I have a Web Service I need to call in Silverlight and I can't figure out how to do it.

Most examples I find aren't 3.0 or are talking about WPF. Any assistance would be appreciated.

EDIT: Made some progress, still can't get it working though. It says it's returning a void but in my service I'm returning a list. (Unless this isn't calling my method. I assumed it added "async" to my method name.)

        FileServiceSoapClient sc = new FileServiceSoapClient();
        List<string> x = sc.GetFilesAsync();
도움이 되었습니까?

해결책

All web service calls need to be non blocking in silverlight. Your FileServiceSoapClient should have completion events that you can wire into which will contain the results of your service calls

For instance something along the lines of

FileServiceSoapClient sc = new FileServiceSoapClient();
sc.GetFilesCompleted += (sender, args) =>
{
     List<string> x = args.Result;
     //do something with "x" here
};
sc.GetFilesAsync();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top