Beispiel #1
0
        public override object GetInitializer(LogicalMethodInfo methodInfo)
        {
            LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo(methodInfo.DeclaringType);

            object[]         ats  = methodInfo.ReturnTypeCustomAttributeProvider.GetCustomAttributes(typeof(XmlRootAttribute), true);
            XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null;

            return(new XmlSerializer(methodInfo.ReturnType, null, null, root, sti.GetWebServiceLiteralNamespace(sti.WebServiceNamespace)));
        }
Beispiel #2
0
        public SoapServerMethod(Type serverType, LogicalMethodInfo methodInfo)
        {
            TypeStubInfo type = TypeStubManager.GetTypeStub(serverType, "Soap");

            info = type.GetMethod(methodInfo.Name) as SoapMethodStubInfo;
            if (info == null)
            {
                throw new InvalidOperationException("Argument methodInfo does not seem to be a member of the server type.");
            }
        }
Beispiel #3
0
        public override object GetInitializer(LogicalMethodInfo methodInfo)
        {
            LogicalTypeInfo sti = TypeStubManager.GetLogicalTypeInfo(methodInfo.DeclaringType);

            object[]         ats  = methodInfo.ReturnTypeCustomAttributeProvider.GetCustomAttributes(typeof(XmlRootAttribute), true);
            XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null;

            XmlReflectionImporter importer = new XmlReflectionImporter();

            importer.IncludeTypes(methodInfo.CustomAttributeProvider);
            XmlTypeMapping map = importer.ImportTypeMapping(methodInfo.ReturnType, root, sti.GetWebServiceLiteralNamespace(sti.WebServiceNamespace));

            return(new XmlSerializer(map));
        }
Beispiel #4
0
        public override object[] GetInitializers(LogicalMethodInfo[] methodInfos)
        {
            XmlReflectionImporter importer = new XmlReflectionImporter();

            XmlMapping[] sers = new XmlMapping [methodInfos.Length];
            for (int n = 0; n < sers.Length; n++)
            {
                LogicalMethodInfo metinfo = methodInfos[n];
                if (metinfo.IsVoid)
                {
                    sers[n] = null;
                }
                else
                {
                    LogicalTypeInfo  sti  = TypeStubManager.GetLogicalTypeInfo(metinfo.DeclaringType);
                    object[]         ats  = methodInfos[n].ReturnTypeCustomAttributeProvider.GetCustomAttributes(typeof(XmlRootAttribute), true);
                    XmlRootAttribute root = ats.Length > 0 ? ats[0] as XmlRootAttribute : null;
                    sers[n] = importer.ImportTypeMapping(methodInfos[n].ReturnType, root, sti.GetWebServiceLiteralNamespace(sti.WebServiceNamespace));
                }
            }
            return(XmlSerializer.FromMappings(sers));
        }
        public SoapDocumentationHandler(Type type, HttpContext context) : base(type)
        {
            _url = context.Request.Url.ToString();
            int i = _url.LastIndexOf('?');

            if (i != -1)
            {
                _url = _url.Substring(0, i);
            }
            _typeStubInfo = (SoapTypeStubInfo)TypeStubManager.GetTypeStub(ServiceType, "Soap");

            HttpRequest req = context.Request;
            string      key = null;

            if (req.QueryString.Count == 1)
            {
                key = req.QueryString.GetKey(0);
                if (key == null)
                {
                    key = req.QueryString [0];
                }

                if (key != null)
                {
                    key = key.ToLower(CultureInfo.InvariantCulture);
                }
            }

            if (key == "wsdl" || key == "schema" || key == "code" || key == "disco")
            {
                return;
            }

#if NET_2_0
            string help = WebServicesSection.Current.WsdlHelpGenerator.Href;
            string path = Path.GetDirectoryName(ConfigurationManager.OpenMachineConfiguration().FilePath);
#else
            string help = WSConfig.Instance.WsdlHelpPage;
            string path = Path.GetDirectoryName(WSConfig.Instance.ConfigFilePath);
#endif
            string appPath = AppDomain.CurrentDomain.GetData(".appPath").ToString();
            string vpath;
            if (path.StartsWith(appPath))
            {
                vpath = path.Substring(appPath.Length);
                vpath = vpath.Replace("\\", "/");
            }
            else
            {
                vpath = "/";
            }

            if (vpath.EndsWith("/"))
            {
                vpath += help;
            }
            else
            {
                vpath += "/" + help;
            }

            string physPath = Path.Combine(path, help);

#if !TARGET_JVM
            if (!File.Exists(physPath))
            {
                throw new InvalidOperationException("Documentation page '" + physPath + "' not found");
            }
#endif

            _pageHandler = PageParser.GetCompiledPageInstance(vpath, physPath, context);
        }
Beispiel #6
0
 public HttpGetClientProtocol()
 {
     TypeStub = (HttpSimpleTypeStubInfo)TypeStubManager.GetTypeStub(GetType(), "HttpGet");
 }
Beispiel #7
0
 public SoapHttpClientProtocol()
 {
     type_info = (SoapTypeStubInfo)TypeStubManager.GetTypeStub(this.GetType(), "Soap");
 }
 public HttpSoapWebServiceHandler(Type type) : base(type)
 {
     _typeStubInfo = (SoapTypeStubInfo)TypeStubManager.GetTypeStub(ServiceType, "Soap");
 }
Beispiel #9
0
 public ServerType(Type type)
 {
     this.type = TypeStubManager.GetLogicalTypeInfo(type);
 }
Beispiel #10
0
 public HttpSimpleWebServiceHandler(Type type, string protocolName)
     : base(type)
 {
     _typeInfo = (HttpSimpleTypeStubInfo)TypeStubManager.GetTypeStub(type, protocolName);
 }