Exemplo n.º 1
0
 private void MoveToOperation(System.Web.Services.Description.Operation operation)
 {
     this.operation        = operation;
     this.operationBinding = null;
     foreach (System.Web.Services.Description.OperationBinding binding in this.binding.Operations)
     {
         if (operation.IsBoundBy(binding))
         {
             if (this.operationBinding != null)
             {
                 throw this.OperationSyntaxException(System.Web.Services.Res.GetString("DuplicateInputOutputNames0"));
             }
             this.operationBinding = binding;
         }
     }
     if (this.operationBinding == null)
     {
         throw this.OperationSyntaxException(System.Web.Services.Res.GetString("MissingBinding0"));
     }
     if ((operation.Messages.Input != null) && (this.operationBinding.Input == null))
     {
         throw this.OperationSyntaxException(System.Web.Services.Res.GetString("MissingInputBinding0"));
     }
     if ((operation.Messages.Output != null) && (this.operationBinding.Output == null))
     {
         throw this.OperationSyntaxException(System.Web.Services.Res.GetString("MissingOutputBinding0"));
     }
     this.inputMessage  = (operation.Messages.Input == null) ? null : this.ServiceDescriptions.GetMessage(operation.Messages.Input.Message);
     this.outputMessage = (operation.Messages.Output == null) ? null : this.ServiceDescriptions.GetMessage(operation.Messages.Output.Message);
 }
        private void ReflectBinding(ReflectedBinding reflectedBinding)
        {
            string identifier = XmlConvert.EncodeLocalName(reflectedBinding.bindingAttr.Name);
            string ns         = reflectedBinding.bindingAttr.Namespace;

            if (identifier.Length == 0)
            {
                identifier = this.Service.Name + this.ProtocolName;
            }
            if (ns.Length == 0)
            {
                ns = this.ServiceDescription.TargetNamespace;
            }
            WsiProfiles none = WsiProfiles.None;

            if (reflectedBinding.bindingAttr.Location.Length > 0)
            {
                this.portType = null;
                this.binding  = null;
            }
            else
            {
                this.bindingServiceDescription = this.GetServiceDescription(ns);
                CodeIdentifiers identifiers = new CodeIdentifiers();
                foreach (System.Web.Services.Description.Binding binding in this.bindingServiceDescription.Bindings)
                {
                    identifiers.AddReserved(binding.Name);
                }
                identifier         = identifiers.AddUnique(identifier, this.binding);
                this.portType      = new System.Web.Services.Description.PortType();
                this.binding       = new System.Web.Services.Description.Binding();
                this.portType.Name = identifier;
                this.binding.Name  = identifier;
                this.binding.Type  = new XmlQualifiedName(this.portType.Name, ns);
                none = reflectedBinding.bindingAttr.ConformsTo & this.ConformsTo;
                if (reflectedBinding.bindingAttr.EmitConformanceClaims && (none != WsiProfiles.None))
                {
                    System.Web.Services.Description.ServiceDescription.AddConformanceClaims(this.binding.GetDocumentationElement(), none);
                }
                this.bindingServiceDescription.Bindings.Add(this.binding);
                this.bindingServiceDescription.PortTypes.Add(this.portType);
            }
            if (this.portNames == null)
            {
                this.portNames = new CodeIdentifiers();
                foreach (System.Web.Services.Description.Port port in this.Service.Ports)
                {
                    this.portNames.AddReserved(port.Name);
                }
            }
            this.port         = new System.Web.Services.Description.Port();
            this.port.Binding = new XmlQualifiedName(identifier, ns);
            this.port.Name    = this.portNames.AddUnique(identifier, this.port);
            this.Service.Ports.Add(this.port);
            this.BeginClass();
            if ((reflectedBinding.methodList != null) && (reflectedBinding.methodList.Count > 0))
            {
                foreach (LogicalMethodInfo info in reflectedBinding.methodList)
                {
                    this.MoveToMethod(info);
                    this.operation      = new System.Web.Services.Description.Operation();
                    this.operation.Name = XmlConvert.EncodeLocalName(info.Name);
                    if ((this.methodAttr.Description != null) && (this.methodAttr.Description.Length > 0))
                    {
                        this.operation.Documentation = this.methodAttr.Description;
                    }
                    this.operationBinding      = new System.Web.Services.Description.OperationBinding();
                    this.operationBinding.Name = this.operation.Name;
                    this.inputMessage          = null;
                    this.outputMessage         = null;
                    this.headerMessages        = null;
                    if (this.ReflectMethod())
                    {
                        if (this.inputMessage != null)
                        {
                            this.bindingServiceDescription.Messages.Add(this.inputMessage);
                        }
                        if (this.outputMessage != null)
                        {
                            this.bindingServiceDescription.Messages.Add(this.outputMessage);
                        }
                        if (this.headerMessages != null)
                        {
                            foreach (Message message in this.headerMessages)
                            {
                                this.bindingServiceDescription.Messages.Add(message);
                            }
                        }
                        this.binding.Operations.Add(this.operationBinding);
                        this.portType.Operations.Add(this.operation);
                    }
                }
            }
            if (((this.binding != null) && (none == WsiProfiles.BasicProfile1_1)) && (this.ProtocolName == "Soap"))
            {
                BasicProfileViolationCollection violations = new BasicProfileViolationCollection();
                WebServicesInteroperability.AnalyzeBinding(this.binding, this.bindingServiceDescription, this.ServiceDescriptions, violations);
                if (violations.Count > 0)
                {
                    throw new InvalidOperationException(System.Web.Services.Res.GetString("WebWsiViolation", new object[] { this.ServiceType.FullName, violations.ToString() }));
                }
            }
            this.EndClass();
        }
 internal void SetParent(System.Web.Services.Description.OperationBinding parent)
 {
     this.parent = parent;
 }
Exemplo n.º 4
0
 public OperationDescription GetOperationDescription(System.Web.Services.Description.OperationBinding operationBinding)
 {
     return(default(OperationDescription));
 }
Exemplo n.º 5
0
 internal void SetParent(System.Web.Services.Description.OperationBinding parent)
 {
     this.parent = parent;
 }
		public System.Web.Services.Description.OperationBinding ReadObject_OperationBinding (bool isNullable, bool checkType)
		{
			System.Web.Services.Description.OperationBinding ob = null;
			if (isNullable && ReadNull()) return null;

			if (checkType) 
			{
				System.Xml.XmlQualifiedName t = GetXsiType();
				if (t != null) 
				{
					if (t.Name != "OperationBinding" || t.Namespace != "http://schemas.xmlsoap.org/wsdl/")
						throw CreateUnknownTypeException(t);
				}
			}

			ob = new System.Web.Services.Description.OperationBinding ();

			Reader.MoveToElement();

			while (Reader.MoveToNextAttribute())
			{
				if (Reader.LocalName == "name" && Reader.NamespaceURI == "") {
					ob.Name = XmlConvert.DecodeName(Reader.Value);
				}
				else if (IsXmlnsAttribute (Reader.Name)) {
				}
				else {
					UnknownNode (ob);
				}
			}

			Reader.MoveToElement();
			if (Reader.IsEmptyElement) {
				Reader.Skip ();
				return ob;
			}

			Reader.ReadStartElement();
			Reader.MoveToContent();

			bool b38=false, b39=false, b40=false, b41=false;

			System.Web.Services.Description.FaultBindingCollection o43 = ob.Faults;
			int n42=0;

			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
			{
				if (Reader.NodeType == System.Xml.XmlNodeType.Element) 
				{
					if (Reader.LocalName == "input" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b39) {
						b39 = true;
						ob.Input = ReadObject_InputBinding (false, true);
					}
					else if (Reader.LocalName == "fault" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b38) {
						if (o43 == null)
							throw CreateReadOnlyCollectionException ("System.Web.Services.Description.FaultBindingCollection");
						o43.Add (ReadObject_FaultBinding (false, true));
						n42++;
					}
					else if (Reader.LocalName == "documentation" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b41) {
						b41 = true;
						ob.Documentation = Reader.ReadElementString ();
					}
					else if (Reader.LocalName == "output" && Reader.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/" && !b40) {
						b40 = true;
						ob.Output = ReadObject_OutputBinding (false, true);
					}
					else {
						ServiceDescription.ReadExtension (Reader, ob);
					}
				}
				else
					UnknownNode(ob);

				Reader.MoveToContent();
			}


			ReadEndElement();

			return ob;
		}
 private void ReflectBinding(ReflectedBinding reflectedBinding)
 {
     string identifier = XmlConvert.EncodeLocalName(reflectedBinding.bindingAttr.Name);
     string ns = reflectedBinding.bindingAttr.Namespace;
     if (identifier.Length == 0)
     {
         identifier = this.Service.Name + this.ProtocolName;
     }
     if (ns.Length == 0)
     {
         ns = this.ServiceDescription.TargetNamespace;
     }
     WsiProfiles none = WsiProfiles.None;
     if (reflectedBinding.bindingAttr.Location.Length > 0)
     {
         this.portType = null;
         this.binding = null;
     }
     else
     {
         this.bindingServiceDescription = this.GetServiceDescription(ns);
         CodeIdentifiers identifiers = new CodeIdentifiers();
         foreach (System.Web.Services.Description.Binding binding in this.bindingServiceDescription.Bindings)
         {
             identifiers.AddReserved(binding.Name);
         }
         identifier = identifiers.AddUnique(identifier, this.binding);
         this.portType = new System.Web.Services.Description.PortType();
         this.binding = new System.Web.Services.Description.Binding();
         this.portType.Name = identifier;
         this.binding.Name = identifier;
         this.binding.Type = new XmlQualifiedName(this.portType.Name, ns);
         none = reflectedBinding.bindingAttr.ConformsTo & this.ConformsTo;
         if (reflectedBinding.bindingAttr.EmitConformanceClaims && (none != WsiProfiles.None))
         {
             System.Web.Services.Description.ServiceDescription.AddConformanceClaims(this.binding.GetDocumentationElement(), none);
         }
         this.bindingServiceDescription.Bindings.Add(this.binding);
         this.bindingServiceDescription.PortTypes.Add(this.portType);
     }
     if (this.portNames == null)
     {
         this.portNames = new CodeIdentifiers();
         foreach (System.Web.Services.Description.Port port in this.Service.Ports)
         {
             this.portNames.AddReserved(port.Name);
         }
     }
     this.port = new System.Web.Services.Description.Port();
     this.port.Binding = new XmlQualifiedName(identifier, ns);
     this.port.Name = this.portNames.AddUnique(identifier, this.port);
     this.Service.Ports.Add(this.port);
     this.BeginClass();
     if ((reflectedBinding.methodList != null) && (reflectedBinding.methodList.Count > 0))
     {
         foreach (LogicalMethodInfo info in reflectedBinding.methodList)
         {
             this.MoveToMethod(info);
             this.operation = new System.Web.Services.Description.Operation();
             this.operation.Name = XmlConvert.EncodeLocalName(info.Name);
             if ((this.methodAttr.Description != null) && (this.methodAttr.Description.Length > 0))
             {
                 this.operation.Documentation = this.methodAttr.Description;
             }
             this.operationBinding = new System.Web.Services.Description.OperationBinding();
             this.operationBinding.Name = this.operation.Name;
             this.inputMessage = null;
             this.outputMessage = null;
             this.headerMessages = null;
             if (this.ReflectMethod())
             {
                 if (this.inputMessage != null)
                 {
                     this.bindingServiceDescription.Messages.Add(this.inputMessage);
                 }
                 if (this.outputMessage != null)
                 {
                     this.bindingServiceDescription.Messages.Add(this.outputMessage);
                 }
                 if (this.headerMessages != null)
                 {
                     foreach (Message message in this.headerMessages)
                     {
                         this.bindingServiceDescription.Messages.Add(message);
                     }
                 }
                 this.binding.Operations.Add(this.operationBinding);
                 this.portType.Operations.Add(this.operation);
             }
         }
     }
     if (((this.binding != null) && (none == WsiProfiles.BasicProfile1_1)) && (this.ProtocolName == "Soap"))
     {
         BasicProfileViolationCollection violations = new BasicProfileViolationCollection();
         WebServicesInteroperability.AnalyzeBinding(this.binding, this.bindingServiceDescription, this.ServiceDescriptions, violations);
         if (violations.Count > 0)
         {
             throw new InvalidOperationException(System.Web.Services.Res.GetString("WebWsiViolation", new object[] { this.ServiceType.FullName, violations.ToString() }));
         }
     }
     this.EndClass();
 }
 private void MoveToOperation(System.Web.Services.Description.Operation operation)
 {
     this.operation = operation;
     this.operationBinding = null;
     foreach (System.Web.Services.Description.OperationBinding binding in this.binding.Operations)
     {
         if (operation.IsBoundBy(binding))
         {
             if (this.operationBinding != null)
             {
                 throw this.OperationSyntaxException(System.Web.Services.Res.GetString("DuplicateInputOutputNames0"));
             }
             this.operationBinding = binding;
         }
     }
     if (this.operationBinding == null)
     {
         throw this.OperationSyntaxException(System.Web.Services.Res.GetString("MissingBinding0"));
     }
     if ((operation.Messages.Input != null) && (this.operationBinding.Input == null))
     {
         throw this.OperationSyntaxException(System.Web.Services.Res.GetString("MissingInputBinding0"));
     }
     if ((operation.Messages.Output != null) && (this.operationBinding.Output == null))
     {
         throw this.OperationSyntaxException(System.Web.Services.Res.GetString("MissingOutputBinding0"));
     }
     this.inputMessage = (operation.Messages.Input == null) ? null : this.ServiceDescriptions.GetMessage(operation.Messages.Input.Message);
     this.outputMessage = (operation.Messages.Output == null) ? null : this.ServiceDescriptions.GetMessage(operation.Messages.Output.Message);
 }