public RetrieveAsyncOp(string webSvcPath, int timeoutPeriod, wsdl.Parser parser, model.IProxy configProxy, ILog log) : base(webSvcPath, timeoutPeriod, configProxy, log) { _webSvcPath = webSvcPath; _downloader = new WsdlDownload(webSvcPath, timeoutPeriod); _parser = parser; }
//System wide proxy settings are not implemented for linux, instead proxy settings must be explicitly set. public static WebProxy GetWebProxy(model.IProxy proxy) { WebProxy webProxy; switch (proxy.ProxyType) { case model.Proxy.EProxyType.Disabled: return null; case model.Proxy.EProxyType.Enabled: webProxy = new WebProxy(proxy.Host, proxy.Port); webProxy.Credentials = CredentialCache.DefaultCredentials; return webProxy; case model.Proxy.EProxyType.System: #if __MonoCS__ return new WebProxy(); #else //Bug fix: WebRequest.GetSystemWebProxy throws a null reference exception on Windows 7 x64. //WebRequest.DefaultWebProxy uses a proxy if set in the web.config otherwise uses the system wide proxy settings from IE webProxy = ConvertToWebProxy(WebRequest.DefaultWebProxy); webProxy.Credentials = CredentialCache.DefaultCredentials; return webProxy; #endif default: return null; } }
protected SyncOp(string name, int timeout, model.IProxy proxy, ILog log) { Log = log; Name = name; Proxy = proxy; TimeoutInSec = timeout; }
public void PopulateForm(string webSvcSrcUri, drexModel.WebSvcMethod webSvcMethod) { _webSvcSrcUri = webSvcSrcUri; uc_wm_request1.PopulateForm(webSvcSrcUri, webSvcMethod); uc_wm_response1.PopulateForm(webSvcMethod.Response.Body, "200 OK", webSvcMethod.Response.Headers[drexModel.WebSvcMessage.HEADER_NAME_CONTENT_TYPE]); uc_wm_request1.OnXmlFormatError += uc_wm_request1_OnXmlFormatError; }
public CallAsyncOp(model.WebSvcMethod webSvcMethod, CancelToken cancelToken, int timeoutPeriod, model.IProxy proxy, ILog log) : base(webSvcMethod.Name, timeoutPeriod, proxy, log) { _webSvcMethod = webSvcMethod; _cancelToken = cancelToken; _cancelObject = new process.WebSvcAsync.CancelObject(webSvcMethod.Name, cancelToken); _cancelObject.OnCancel += _cancelObject_OnCancel; }
public void PopulateForm(string webSvcSrcUri, drexModel.WebSvcMethod webSvcMethod) { _webSvcMethod = webSvcMethod; tec_Request.Text = webSvcMethod.Request.Body; pg_headers.SelectedObject = new RequestPropertyGrid(webSvcSrcUri, webSvcMethod.Name, webSvcMethod.Request.Headers[drexModel.WebSvcMessage.HEADER_NAME_CONTENT_TYPE], webSvcMethod.Request.Headers[drexModel.WebSvcMessageRequest.HEADER_NAME_SOAP_ACTION], webSvcMethod.ServiceURI); }
protected AsyncOp(string name, int timeout, model.IProxy proxy, ILog log) { Log = log; Name = name; Proxy = proxy; TimeoutInSec = timeout; _timeoutObject = new TimeoutObject(Name, timeout); _timeoutObject.OnTimeout += _timeoutObject_OnTimeout; }
//returns true if service descriptions are retrieved //returns false if 0 service descriptions found, this signifies that the end point is not a web service description internal bool Download(model.IProxy proxy, out List<wsdlDescription.ServiceDescription> descriptions, out List<XmlSchema> schemas) { descriptions = new List<wsdlDescription.ServiceDescription>(); schemas = new List<XmlSchema>(); if (_wsdlEndpoint.StartsWith("file")) { DownloadFile(out descriptions, out schemas); } else { DownloadWeb(proxy, out descriptions, out schemas); } return (descriptions.Count > 0); }
public static BasicHttpBinding GetWsdlBinding(model.IProxy proxy) { BasicHttpBinding binding = new BasicHttpBinding(); if (proxy.ProxyType == model.Proxy.EProxyType.System) { binding.UseDefaultWebProxy = true; } else { WebProxy webProxy = ProxyWrapper.GetWebProxy(proxy); binding.UseDefaultWebProxy = false; if (proxy.ProxyType == model.Proxy.EProxyType.Enabled) { binding.ProxyAddress = webProxy.Address; } } return binding; }
public static WSHttpBinding GetMexBinding(model.IProxy proxy) { WSHttpBinding binding = new WSHttpBinding(); binding.Security.Mode = SecurityMode.None; if (proxy.ProxyType == model.Proxy.EProxyType.System) { binding.UseDefaultWebProxy = true; } else { WebProxy webProxy = ProxyWrapper.GetWebProxy(proxy); binding.UseDefaultWebProxy = false; if (proxy.ProxyType == model.Proxy.EProxyType.Enabled) { binding.ProxyAddress = webProxy.Address; } } return binding; }
void CallWebSvcCallAsync(drexModel.WebSvcMethod webSvcMethod) { utils.Logger.Instance.Log.Info("Start " + webSvcMethod.Name); _cancelToken = new drexProcess.WebSvcAsync.CancelToken(); Thread thread = new Thread(() => { var call = new drexProcess.WebSvcAsync.Operations.CallAsyncOp(webSvcMethod, _cancelToken, State.Instance.ConfigTimeout.Timeout, State.Instance.ConfigProxy, utils.Logger.Instance.Log); call.OnComplete += call_OnComplete; call.OnWebException += call_OnWebException; call.OnException += call_OnException; call.OnCancel += call_OnCancel; call.OnTimeout += call_OnTimeout; call.Start(); }); //the windows forms control must be updated by a thread with single threaded appartment property thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
//TODO: FB client.GetMetadata is not working working on linux, instead use DiscoveryClientProtocol. //this means that mex bindings are currently not supported on linux void DownloadWeb(model.IProxy proxy, out List<wsdlDescription.ServiceDescription> descriptions, out List<XmlSchema> schemas) { DiscoveryClientProtocol client = new DiscoveryClientProtocol(); if (proxy.ProxyType == model.Proxy.EProxyType.Enabled) { client.Proxy = new System.Net.WebProxy(proxy.Host, proxy.Port); client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials; } descriptions = new List<wsdlDescription.ServiceDescription>(); schemas = new List<XmlSchema>(); //download document client.AllowAutoRedirect = true; client.Timeout = _timeoutInSeconds * 1000; client.Documents.Clear(); client.DiscoverAny(_wsdlEndpoint); client.ResolveAll(); //generate stub foreach (var v in client.Documents.Values) { if (v is wsdlDescription.ServiceDescription) { descriptions.Add((wsdlDescription.ServiceDescription)v); } else if (v is XmlSchema) { schemas.Add((XmlSchema)v); } } }
void DownloadWeb(model.IProxy proxy, out List<wsdlDescription.ServiceDescription> descriptions, out List<XmlSchema> schemas) { descriptions = new List<wsdlDescription.ServiceDescription>(); schemas = new List<XmlSchema>(); MetadataExchangeClient client; MetadataExchangeClientMode exchangeMode; if (_wsdlEndpoint.EndsWith("mex")) { WSHttpBinding mexBinding = utils.BindingWrapper.GetMexBinding(proxy); client = new MetadataExchangeClient(mexBinding); exchangeMode = MetadataExchangeClientMode.MetadataExchange; } else { BasicHttpBinding wsdlBinding = utils.BindingWrapper.GetWsdlBinding(proxy); client = new MetadataExchangeClient(wsdlBinding); exchangeMode = MetadataExchangeClientMode.HttpGet; } client.ResolveMetadataReferences = true; client.OperationTimeout = new TimeSpan(0, 0, _timeoutInSeconds); MetadataSet metadata = client.GetMetadata(new Uri(_wsdlEndpoint), exchangeMode); foreach (var metaDataSection in metadata.MetadataSections) { if (metaDataSection.Metadata is wsdlDescription.ServiceDescription) { descriptions.Add((wsdlDescription.ServiceDescription)metaDataSection.Metadata); } else if (metaDataSection.Metadata is XmlSchema) { schemas.Add((XmlSchema)metaDataSection.Metadata); } } }
public RetrieveAsyncResult(model.WebSvc webSvcResult) { WebSvcResult = webSvcResult; }
public CallSyncOp(model.WebSvcMethod webSvcMethod) : base(webSvcMethod.Name, DEFAULT_TIMEOUT) { _webSvcMethod = webSvcMethod; }
public CallSyncOp(model.WebSvcMethod webSvcMethod, int timeoutPeriod, model.Proxy proxy, ILog log) : base(webSvcMethod.Name, timeoutPeriod, proxy, log) { _webSvcMethod = webSvcMethod; }
public UpdateAsyncOp(string updateUrl, string version, drexModel.IProxy configProxy, int timeoutPeriod) : base("UpdateAsyncOp", timeoutPeriod, configProxy, utils.Logger.Instance.Log) { _updateUrl = updateUrl; _version = version; }