Here I have a static class that i access on every call to the WCF web service.
this is how I use this to communicate with WCF webservice
ActionServiceClient proxy = ServiceUtil.GetActionServiceClient();
proxy.YourMethodCompleted += new EventHandler
proxy.GetPositionListAsync(request);
public static ActionService.ActionServiceClient GetActionServiceClient()
{
BasicHttpBinding binding = new BasicHttpBinding(System.Windows.Browser.HtmlPage.Document.DocumentUri.Scheme.ToLower() == "https" ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None);
binding.MaxReceivedMessageSize = int.MaxValue;
binding.MaxBufferSize = int.MaxValue;
binding.SendTimeout = new TimeSpan(0, 2, 0);
binding.ReceiveTimeout = new TimeSpan(0, 2, 0);
return new ActionService.ActionServiceClient(binding, new EndpointAddress(
new Uri(Application.Current.Resources["ActionServiceURL"].ToString())));
}
The only thing of note is the endpoint address, its added as a resource to the silverlight application in the init parameters in the ASPX page that launches silverlight. I will explain in another blog how to use init parameters in silverlight.
No comments:
Post a Comment