protected override CodeTypeDeclaration BeginClass()
        {
            httpBinding = (HttpBinding)Binding.Extensions.Find(typeof(HttpBinding));

            CodeTypeDeclaration codeClass = new CodeTypeDeclaration(ClassName);

#if NET_2_0
            codeClass.IsPartial = true;
#endif

            string location = null;
            if (Port != null)
            {
                HttpAddressBinding sab = (HttpAddressBinding)Port.Extensions.Find(typeof(HttpAddressBinding));
                if (sab != null)
                {
                    location = sab.Location;
                }
            }

            CodeConstructor cc = new CodeConstructor();
            cc.Attributes = MemberAttributes.Public;
            GenerateServiceUrl(location, cc.Statements);
            codeClass.Members.Add(cc);

            memberIds = new CodeIdentifiers();
            return(codeClass);
        }
        protected override CodeTypeDeclaration BeginClass()
        {
            methodNames.Clear();
            CodeAttributeDeclarationCollection metadata = new CodeAttributeDeclarationCollection();

            if (Style == ServiceDescriptionImportStyle.Client)
            {
                WebCodeGenerator.AddCustomAttribute(metadata, typeof(DebuggerStepThroughAttribute), new CodeExpression[0]);
                WebCodeGenerator.AddCustomAttribute(metadata, typeof(DesignerCategoryAttribute), new CodeExpression[] { new CodePrimitiveExpression("code") });
            }

            Type[] requiredTypes = new Type[] { typeof(SoapDocumentMethodAttribute), typeof(XmlAttributeAttribute), typeof(WebService), typeof(Object), typeof(DebuggerStepThroughAttribute), typeof(DesignerCategoryAttribute) };
            WebCodeGenerator.AddImports(this.CodeNamespace, WebCodeGenerator.GetNamespacesForTypes(requiredTypes));
            CodeTypeDeclaration codeClass = WebCodeGenerator.CreateClass(this.ClassName, BaseClass.FullName,
                                                                         new string[0], metadata, CodeFlags.IsPublic | (Style == ServiceDescriptionImportStyle.Client ? 0 : CodeFlags.IsAbstract));

            codeClass.Comments.Add(new CodeCommentStatement("<remarks/>", true));

            CodeConstructor ctor = WebCodeGenerator.AddConstructor(codeClass, new string[0], new string[0], null, CodeFlags.IsPublic);

            ctor.Comments.Add(new CodeCommentStatement("<remarks/>", true));

            HttpAddressBinding httpAddressBinding = Port == null ? null : (HttpAddressBinding)Port.Extensions.Find(typeof(HttpAddressBinding));
            string             url = (httpAddressBinding != null) ? httpAddressBinding.Location : null;
            ServiceDescription serviceDescription = Binding.ServiceDescription;

            ProtocolImporterUtil.GenerateConstructorStatements(ctor, url, serviceDescription.AppSettingUrlKey, serviceDescription.AppSettingBaseUrl);

            codeClasses.Add(codeClass);
            return(codeClass);
        }
        protected override void BeginClass()
        {
            HttpAddressBinding abind = new HttpAddressBinding();

            abind.Location = ServiceUrl;
            Port.Extensions.Add(abind);
        }
        protected override void BeginClass()
        {
            HttpBinding httpBinding = new HttpBinding();

            httpBinding.Verb = "POST";
            Binding.Extensions.Add(httpBinding);

            HttpAddressBinding httpAddressBinding = new HttpAddressBinding();

            httpAddressBinding.Location = ServiceUrl;
            Port.Extensions.Add(httpAddressBinding);
        }
 protected override void BeginClass()
 {
     if (!base.IsEmptyBinding)
     {
         HttpBinding extension = new HttpBinding {
             Verb = "POST"
         };
         base.Binding.Extensions.Add(extension);
         HttpAddressBinding binding2 = new HttpAddressBinding {
             Location = base.ServiceUrl
         };
         base.Port.Extensions.Add(binding2);
     }
 }
Exemple #6
0
 protected override void BeginClass()
 {
     if (!base.IsEmptyBinding)
     {
         HttpBinding extension = new HttpBinding {
             Verb = "GET"
         };
         base.Binding.Extensions.Add(extension);
         HttpAddressBinding binding2 = new HttpAddressBinding {
             Location = base.ServiceUrl
         };
         base.Port.Extensions.Add(binding2);
     }
 }
 protected override void BeginClass() {
     if (IsEmptyBinding)
         return;
     HttpBinding httpBinding = new HttpBinding();
     httpBinding.Verb = "GET";
     Binding.Extensions.Add(httpBinding);
     HttpAddressBinding httpAddressBinding = new HttpAddressBinding();
     httpAddressBinding.Location = ServiceUrl;
     if (this.UriFixups != null)
     {
         this.UriFixups.Add(delegate(Uri current)
         {
             httpAddressBinding.Location = DiscoveryServerType.CombineUris(current, httpAddressBinding.Location);
         });
     }
     Port.Extensions.Add(httpAddressBinding);
 }
        protected override void BeginClass()
        {
            if (IsEmptyBinding)
            {
                return;
            }
            HttpBinding httpBinding = new HttpBinding();

            httpBinding.Verb = "POST";
            Binding.Extensions.Add(httpBinding);
            HttpAddressBinding httpAddressBinding = new HttpAddressBinding();

            httpAddressBinding.Location = ServiceUrl;
            if (this.UriFixups != null)
            {
                this.UriFixups.Add(delegate(Uri current)
                {
                    httpAddressBinding.Location = DiscoveryServerType.CombineUris(current, httpAddressBinding.Location);
                });
            }
            Port.Extensions.Add(httpAddressBinding);
        }
        protected override CodeTypeDeclaration BeginClass()
        {
            base.MethodNames.Clear();
            base.ExtraCodeClasses.Clear();
            CodeAttributeDeclarationCollection metadata = new CodeAttributeDeclarationCollection();

            if (base.Style == ServiceDescriptionImportStyle.Client)
            {
                WebCodeGenerator.AddCustomAttribute(metadata, typeof(DebuggerStepThroughAttribute), new CodeExpression[0]);
                WebCodeGenerator.AddCustomAttribute(metadata, typeof(DesignerCategoryAttribute), new CodeExpression[] { new CodePrimitiveExpression("code") });
            }
            Type[] types = new Type[] { typeof(SoapDocumentMethodAttribute), typeof(XmlAttributeAttribute), typeof(WebService), typeof(object), typeof(DebuggerStepThroughAttribute), typeof(DesignerCategoryAttribute), typeof(TransactionOption) };
            WebCodeGenerator.AddImports(base.CodeNamespace, WebCodeGenerator.GetNamespacesForTypes(types));
            CodeFlags isAbstract = (CodeFlags)0;

            if (base.Style == ServiceDescriptionImportStyle.Server)
            {
                isAbstract = CodeFlags.IsAbstract;
            }
            else if (base.Style == ServiceDescriptionImportStyle.ServerInterface)
            {
                isAbstract = CodeFlags.IsInterface;
            }
            CodeTypeDeclaration codeClass = WebCodeGenerator.CreateClass(base.ClassName, this.BaseClass.FullName, new string[0], metadata, CodeFlags.IsPublic | isAbstract, base.ServiceImporter.CodeGenerator.Supports(GeneratorSupport.PartialTypes));

            codeClass.Comments.Add(new CodeCommentStatement(System.Web.Services.Res.GetString("CodeRemarks"), true));
            CodeConstructor ctor = WebCodeGenerator.AddConstructor(codeClass, new string[0], new string[0], null, CodeFlags.IsPublic);

            ctor.Comments.Add(new CodeCommentStatement(System.Web.Services.Res.GetString("CodeRemarks"), true));
            HttpAddressBinding binding            = (base.Port == null) ? null : ((HttpAddressBinding)base.Port.Extensions.Find(typeof(HttpAddressBinding)));
            string             url                = (binding != null) ? binding.Location : null;
            ServiceDescription serviceDescription = base.Binding.ServiceDescription;

            ProtocolImporterUtil.GenerateConstructorStatements(ctor, url, serviceDescription.AppSettingUrlKey, serviceDescription.AppSettingBaseUrl, false);
            this.codeClasses.Add(codeClass);
            return(codeClass);
        }
 private void Write118_HttpAddressBinding(string n, string ns, HttpAddressBinding o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(HttpAddressBinding)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.WriteStartElement(n, ns, o, false, null);
         if (needType)
         {
             base.WriteXsiType("HttpAddressBinding", "http://schemas.xmlsoap.org/wsdl/http/");
         }
         if (o.Required)
         {
             base.WriteAttribute("required", "http://schemas.xmlsoap.org/wsdl/", XmlConvert.ToString(o.Required));
         }
         base.WriteAttribute("location", "", o.Location);
         base.WriteEndElement(o);
     }
 }
		protected override void BeginClass ()
		{
			HttpAddressBinding abind = new HttpAddressBinding ();
			abind.Location = ServiceUrl;
			Port.Extensions.Add (abind);
		}