Esempio n. 1
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);
        }
Esempio n. 2
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 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;
 }
Esempio n. 4
0
 void GenerateCode(MimeXmlReturn importedReturn)
 {
     Exporter.ExportTypeMapping(importedReturn.TypeMapping);
 }
 void GenerateCode(MimeXmlReturn importedReturn) {
     Exporter.ExportTypeMapping(importedReturn.TypeMapping);
 }