问题
private void btnUpdate_Click(object sender, RoutedEventArgs e)
{
xxxxxxx.Workflow1_WebServiceSoapClient zer = new xxxxx.Workflow1_WebServiceSoapClient();
zer.demanderSubmitReportCompleted += new EventHandler<xxxxxxxxxxxxxxx.demanderSubmitReportCompletedEventArgs>(service2);
zer.demanderSubmitReportAsync("zzz", 20000);
}
public void service2(object sender, xxxxx.demanderSubmitReportCompletedEventArgs e)
{
string a = e.Result;
}
I'm trying to call a Windows Workflow Foundation published as a web service from a Silverlight project. When I call it from a console application it works fine because I can add a web reference then I just make an instance of that webservice then I invoke the method I want. The problem is in the Silverlight project because I can just add a service reference so I find myself working with SOAP stuff that doesn't work at all, and here is the code error:
Here is the code: I change it a litle bit in English.
Error in exécution Microsoft JScript: Unhandled Error in Silverlight Application exception happened in the operation, résult not valide. Consult InnerException for more information. in System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
in AEDSilverlightIntegrated.ServiceReference2.demanderSubmitReportCompletedEventArgs.get_Result()
in AEDSilverlightIntegrated.SilverEntryAedHeaderNew.mmm_demanderSubmitReportCompleted(Object sender, demanderSubmitReportCompletedEventArgs e)
in AEDSilverlightIntegrated.ServiceReference2.Workflow1_WebServiceSoapClient.OndemanderSubmitReportCompleted(Object state)
回答1:
Well, I found a solution and I want to share it with all of you. The solution is to build a web service that works as a bridge between Windows Workflow Foundation published as a web service and a Silverlight application. Not so genious, but this resolve the problem.
回答2:
First things first. Make sure that the service exposes a cross-domain policy file to allow Silverlight to make the cross-domain call.
This is only required if the service is on a different domain to the Silverlight host page.
来源:https://stackoverflow.com/questions/2681653/silverlight-and-windows-workflow-foundation