コード例 #1
0
    object IWebServiceProvider.LoadWebService(string url)
    {
        if (url.EndsWith(".asmx", StringComparison.OrdinalIgnoreCase))
        {
            url += "?WSDL";
        }

        byte[] data = DynamicWebServiceHelpers.GetBytesForUrl(url);
        return(CreateWebServiceFromWsdl(data));
    }
コード例 #2
0
        public object Invoke([ParamDictionary] IDictionary <object, object> args)
        {
            string url = _url;

            // append arguments to query string
            if (args != null && args.Count > 0)
            {
                StringBuilder sb = new StringBuilder(url);

                bool first = false;

                if (url.IndexOf('?') < 0)
                {
                    sb.Append('?');
                    first = true;
                }
                else if (url.EndsWith("?"))
                {
                    first = true;
                }

                foreach (KeyValuePair <object, object> p in (IDictionary <object, object>)args)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        sb.Append('&');
                    }

                    sb.Append(HttpUtility.UrlEncode(p.Key.ToString()));
                    sb.Append('=');
                    sb.Append(HttpUtility.UrlEncode(p.Value.ToString()));
                }

                url = sb.ToString();
            }

            // download XML
            byte[] responseBytes = DynamicWebServiceHelpers.GetBytesForUrl(url);
            return(DynamicWebServiceHelpers.LoadXmlFromBytes(responseBytes));
        }
コード例 #3
0
 object IWebServiceProvider.LoadWebService(string url)
 {
     byte[] rssBytes = DynamicWebServiceHelpers.GetBytesForUrl(url);
     return(DynamicWebServiceHelpers.LoadXmlFromBytes(rssBytes));
 }
コード例 #4
0
 public static XmlElement Load(string text)
 {
     return(DynamicWebServiceHelpers.LoadXmlFromString(text));
 }