internal override bool ReflectReturn() {
            MessagePart part = new MessagePart();
            part.Name = "Body";
            ReflectionContext.OutputMessage.Parts.Add(part);

            if (typeof(XmlNode).IsAssignableFrom(ReflectionContext.Method.ReturnType)) {
                MimeContentBinding mimeContentBinding = new MimeContentBinding();
                mimeContentBinding.Type = "text/xml";
                mimeContentBinding.Part = part.Name;
                ReflectionContext.OperationBinding.Output.Extensions.Add(mimeContentBinding);
            }
            else {
                MimeXmlBinding mimeXmlBinding = new MimeXmlBinding();
                mimeXmlBinding.Part = part.Name;

                LogicalMethodInfo methodInfo = ReflectionContext.Method;
                XmlAttributes a = new XmlAttributes(methodInfo.ReturnTypeCustomAttributeProvider);
                XmlTypeMapping xmlTypeMapping = ReflectionContext.ReflectionImporter.ImportTypeMapping(methodInfo.ReturnType, a.XmlRoot);
                xmlTypeMapping.SetKey(methodInfo.GetKey() + ":Return");
                ReflectionContext.SchemaExporter.ExportTypeMapping(xmlTypeMapping);
                part.Element = new XmlQualifiedName(xmlTypeMapping.XsdElementName, xmlTypeMapping.Namespace);
                ReflectionContext.OperationBinding.Output.Extensions.Add(mimeXmlBinding);
            }

            return true;
        }
 internal override bool ReflectReturn()
 {
     MessagePart messagePart = new MessagePart {
         Name = "Body"
     };
     base.ReflectionContext.OutputMessage.Parts.Add(messagePart);
     if (typeof(XmlNode).IsAssignableFrom(base.ReflectionContext.Method.ReturnType))
     {
         MimeContentBinding extension = new MimeContentBinding {
             Type = "text/xml",
             Part = messagePart.Name
         };
         base.ReflectionContext.OperationBinding.Output.Extensions.Add(extension);
     }
     else
     {
         MimeXmlBinding binding2 = new MimeXmlBinding {
             Part = messagePart.Name
         };
         LogicalMethodInfo method = base.ReflectionContext.Method;
         XmlAttributes attributes = new XmlAttributes(method.ReturnTypeCustomAttributeProvider);
         XmlTypeMapping xmlTypeMapping = base.ReflectionContext.ReflectionImporter.ImportTypeMapping(method.ReturnType, attributes.XmlRoot);
         xmlTypeMapping.SetKey(method.GetKey() + ":Return");
         base.ReflectionContext.SchemaExporter.ExportTypeMapping(xmlTypeMapping);
         messagePart.Element = new XmlQualifiedName(xmlTypeMapping.XsdElementName, xmlTypeMapping.Namespace);
         base.ReflectionContext.OperationBinding.Output.Extensions.Add(binding2);
     }
     return true;
 }
 internal override bool ReflectParameters() {
     if (!HtmlFormParameterReader.IsSupported(ReflectionContext.Method))
         return false;
     ReflectionContext.ReflectStringParametersMessage();
     MimeContentBinding mimeContentBinding = new MimeContentBinding();
     mimeContentBinding.Type = HtmlFormParameterReader.MimeType;
     ReflectionContext.OperationBinding.Input.Extensions.Add(mimeContentBinding);
     return true;
 }
Example #4
0
		protected override bool ReflectMethod ()
		{
			if (!base.ReflectMethod ()) return false;
			
			MimeContentBinding mcb = new MimeContentBinding ();
			mcb.Type = "application/x-www-form-urlencoded";
			mcb.Part = null;
			OperationBinding.Input.Extensions.Add (mcb);
			return true;
		}
 internal override bool ReflectParameters()
 {
     if (!ValueCollectionParameterReader.IsSupported(base.ReflectionContext.Method))
     {
         return false;
     }
     base.ReflectionContext.ReflectStringParametersMessage();
     MimeContentBinding extension = new MimeContentBinding {
         Type = "application/x-www-form-urlencoded"
     };
     base.ReflectionContext.OperationBinding.Input.Extensions.Add(extension);
     return true;
 }
Example #6
0
        internal override bool ReflectParameters()
        {
            if (!HtmlFormParameterReader.IsSupported(ReflectionContext.Method))
            {
                return(false);
            }
            ReflectionContext.ReflectStringParametersMessage();
            MimeContentBinding mimeContentBinding = new MimeContentBinding();

            mimeContentBinding.Type = HtmlFormParameterReader.MimeType;
            ReflectionContext.OperationBinding.Input.Extensions.Add(mimeContentBinding);
            return(true);
        }
Example #7
0
        internal override MimeReturn ImportReturn()
        {
            MimeContentBinding mimeContentBinding = (MimeContentBinding)ImportContext.OperationBinding.Output.Extensions.Find(typeof(MimeContentBinding));

            if (mimeContentBinding != null)
            {
                if (!ContentType.MatchesBase(mimeContentBinding.Type, ContentType.TextXml))
                {
                    return(null);
                }
                MimeReturn importedReturn = new MimeReturn();
                importedReturn.TypeName   = typeof(XmlElement).FullName;
                importedReturn.ReaderType = typeof(XmlReturnReader);
                return(importedReturn);
            }

            MimeXmlBinding mimeXmlBinding = (MimeXmlBinding)ImportContext.OperationBinding.Output.Extensions.Find(typeof(MimeXmlBinding));

            if (mimeXmlBinding != null)
            {
                MimeXmlReturn importedReturn = new MimeXmlReturn();
                MessagePart   part;
                switch (ImportContext.OutputMessage.Parts.Count)
                {
                case 0:
                    throw new InvalidOperationException(Res.GetString(Res.MessageHasNoParts1, ImportContext.InputMessage.Name));

                case 1:
                    if (mimeXmlBinding.Part == null || mimeXmlBinding.Part.Length == 0)
                    {
                        part = ImportContext.OutputMessage.Parts[0];
                    }
                    else
                    {
                        part = ImportContext.OutputMessage.FindPartByName(mimeXmlBinding.Part);
                    }
                    break;

                default:
                    part = ImportContext.OutputMessage.FindPartByName(mimeXmlBinding.Part);
                    break;
                }
                importedReturn.TypeMapping = Importer.ImportTypeMapping(part.Element);
                importedReturn.TypeName    = importedReturn.TypeMapping.TypeFullName;
                importedReturn.ReaderType  = typeof(XmlReturnReader);
                Exporter.AddMappingMetadata(importedReturn.Attributes, importedReturn.TypeMapping, string.Empty);
                return(importedReturn);
            }
            return(null);
        }
        protected override Type GetInMimeFormatter()
        {
            MimeContentBinding bin = OperationBinding.Input.Extensions.Find(typeof(MimeContentBinding)) as MimeContentBinding;

            if (bin == null)
            {
                throw new Exception("Http mime:content binding not found");
            }
            if (bin.Type != "application/x-www-form-urlencoded")
            {
                throw new Exception("Encoding of mime:content binding not supported");
            }
            return(typeof(HtmlFormParameterWriter));
        }
Example #9
0
        protected override bool ReflectMethod()
        {
            if (!base.ReflectMethod())
            {
                return(false);
            }

            MimeContentBinding mcb = new MimeContentBinding();

            mcb.Type = "application/x-www-form-urlencoded";
            mcb.Part = null;
            OperationBinding.Input.Extensions.Add(mcb);
            return(true);
        }
        internal override bool ReflectParameters()
        {
            if (!ValueCollectionParameterReader.IsSupported(base.ReflectionContext.Method))
            {
                return(false);
            }
            base.ReflectionContext.ReflectStringParametersMessage();
            MimeContentBinding extension = new MimeContentBinding {
                Type = "application/x-www-form-urlencoded"
            };

            base.ReflectionContext.OperationBinding.Input.Extensions.Add(extension);
            return(true);
        }
        protected virtual Type GetOutMimeFormatter()
        {
            if (OperationBinding.Output.Extensions.Find(typeof(MimeXmlBinding)) != null)
            {
                return(typeof(XmlReturnReader));
            }

            MimeContentBinding bin = (MimeContentBinding)OperationBinding.Output.Extensions.Find(typeof(MimeContentBinding));

            if (bin != null && bin.Type == "text/xml")
            {
                return(typeof(XmlReturnReader));
            }

            return(typeof(NopReturnReader));
        }
Example #12
0
        internal override MimeReturn ImportReturn()
        {
            MessagePart        part;
            MimeContentBinding binding = (MimeContentBinding)base.ImportContext.OperationBinding.Output.Extensions.Find(typeof(MimeContentBinding));

            if (binding != null)
            {
                if (!ContentType.MatchesBase(binding.Type, "text/xml"))
                {
                    return(null);
                }
                return(new MimeReturn {
                    TypeName = typeof(XmlElement).FullName, ReaderType = typeof(XmlReturnReader)
                });
            }
            MimeXmlBinding binding2 = (MimeXmlBinding)base.ImportContext.OperationBinding.Output.Extensions.Find(typeof(MimeXmlBinding));

            if (binding2 == null)
            {
                return(null);
            }
            MimeXmlReturn return3 = new MimeXmlReturn();

            switch (base.ImportContext.OutputMessage.Parts.Count)
            {
            case 0:
                throw new InvalidOperationException(System.Web.Services.Res.GetString("MessageHasNoParts1", new object[] { base.ImportContext.InputMessage.Name }));

            case 1:
                if ((binding2.Part != null) && (binding2.Part.Length != 0))
                {
                    part = base.ImportContext.OutputMessage.FindPartByName(binding2.Part);
                    break;
                }
                part = base.ImportContext.OutputMessage.Parts[0];
                break;

            default:
                part = base.ImportContext.OutputMessage.FindPartByName(binding2.Part);
                break;
            }
            return3.TypeMapping = this.Importer.ImportTypeMapping(part.Element);
            return3.TypeName    = return3.TypeMapping.TypeFullName;
            return3.ReaderType  = typeof(XmlReturnReader);
            this.Exporter.AddMappingMetadata(return3.Attributes, return3.TypeMapping, string.Empty);
            return(return3);
        }
        internal override MimeParameterCollection ImportParameters()
        {
            MimeContentBinding binding = (MimeContentBinding)base.ImportContext.OperationBinding.Input.Extensions.Find(typeof(MimeContentBinding));

            if (binding == null)
            {
                return(null);
            }
            if (string.Compare(binding.Type, "application/x-www-form-urlencoded", StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(null);
            }
            MimeParameterCollection parameters = base.ImportContext.ImportStringParametersMessage();

            if (parameters == null)
            {
                return(null);
            }
            parameters.WriterType = typeof(HtmlFormParameterWriter);
            return(parameters);
        }
        internal override MimeParameterCollection ImportParameters()
        {
            MimeContentBinding mimeContentBinding = (MimeContentBinding)ImportContext.OperationBinding.Input.Extensions.Find(typeof(MimeContentBinding));

            if (mimeContentBinding == null)
            {
                return(null);
            }
            if (string.Compare(mimeContentBinding.Type, HtmlFormParameterReader.MimeType, StringComparison.OrdinalIgnoreCase) != 0)
            {
                return(null);
            }
            MimeParameterCollection parameters = ImportContext.ImportStringParametersMessage();

            if (parameters == null)
            {
                return(null);
            }
            parameters.WriterType = typeof(HtmlFormParameterWriter);
            return(parameters);
        }
 private void Write93_MimeContentBinding(string n, string ns, MimeContentBinding o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(MimeContentBinding)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.WriteStartElement(n, ns, o, false, null);
         if (needType)
         {
             base.WriteXsiType("MimeContentBinding", "http://schemas.xmlsoap.org/wsdl/mime/");
         }
         if (o.Required)
         {
             base.WriteAttribute("required", "http://schemas.xmlsoap.org/wsdl/", XmlConvert.ToString(o.Required));
         }
         base.WriteAttribute("part", "", o.Part);
         base.WriteAttribute("type", "", o.Type);
         base.WriteEndElement(o);
     }
 }