System.Web.Services.Discovery.SoapBinding Read9_SoapBinding(bool isNullable, bool checkType)
 {
     if (isNullable && ReadNull())
     {
         return(null);
     }
     if (checkType)
     {
         System.Xml.XmlQualifiedName t = GetXsiType();
         if (t == null || ((object)((System.Xml.XmlQualifiedName)t).Name == (object)id14_SoapBinding && (object)((System.Xml.XmlQualifiedName)t).Namespace == (object)id6_httpschemasxmlsoaporgdiscosoap))
         {
             ;
         }
         else
         {
             throw CreateUnknownTypeException((System.Xml.XmlQualifiedName)t);
         }
     }
     System.Web.Services.Discovery.SoapBinding o = new System.Web.Services.Discovery.SoapBinding();
     bool[] paramsRead = new bool[2];
     while (Reader.MoveToNextAttribute())
     {
         if (!paramsRead[0] && ((object)Reader.LocalName == (object)id19_address && (object)Reader.NamespaceURI == (object)id12_Item))
         {
             o.@Address    = Reader.Value;
             paramsRead[0] = true;
         }
         else if (!paramsRead[1] && ((object)Reader.LocalName == (object)id20_binding && (object)Reader.NamespaceURI == (object)id12_Item))
         {
             o.@Binding    = ToXmlQualifiedName(Reader.Value);
             paramsRead[1] = true;
         }
         else if (!IsXmlnsAttribute(Reader.Name))
         {
             UnknownNode((object)o);
         }
     }
     Reader.MoveToElement();
     if (Reader.IsEmptyElement)
     {
         Reader.Skip();
         return(o);
     }
     Reader.ReadStartElement();
     Reader.MoveToContent();
     while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
     {
         if (Reader.NodeType == System.Xml.XmlNodeType.Element)
         {
             UnknownNode((object)o);
         }
         else
         {
             UnknownNode((object)o);
         }
         Reader.MoveToContent();
     }
     ReadEndElement();
     return(o);
 }
 void Write9_SoapBinding(string n, string ns, System.Web.Services.Discovery.SoapBinding o, bool isNullable, bool needType)
 {
     if ((object)o == null)
     {
         if (isNullable)
         {
             WriteNullTagLiteral(n, ns);
         }
         return;
     }
     if (!needType)
     {
         System.Type t = o.GetType();
         if (t == typeof(System.Web.Services.Discovery.SoapBinding))
         {
             ;
         }
         else
         {
             throw CreateUnknownTypeException(o);
         }
     }
     WriteStartElement(n, ns, o);
     if (needType)
     {
         WriteXsiType(@"SoapBinding", @"http://schemas.xmlsoap.org/disco/soap/");
     }
     WriteAttribute(@"address", @"", (System.String)o.@Address);
     WriteAttribute(@"binding", @"", FromXmlQualifiedName((System.Xml.XmlQualifiedName)o.@Binding));
     WriteEndElement(o);
 }
        void WriteObject_SoapBinding(System.Web.Services.Discovery.SoapBinding ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem)
        {
            if (ob == null)
            {
                if (isNullable)
                {
                    WriteNullTagLiteral(element, namesp);
                }
                return;
            }

            if (writeWrappingElem)
            {
                WriteStartElement(element, namesp, ob);
            }

            if (needType)
            {
                WriteXsiType("SoapBinding", "http://schemas/xmlsoap.org/disco/schema/soap/");
            }

            WriteAttribute("binding", "", FromXmlQualifiedName(ob.@Binding));
            WriteAttribute("address", "", ob.@Address);

            if (writeWrappingElem)
            {
                WriteEndElement(ob);
            }
        }
Exemplo n.º 4
0
		public System.Web.Services.Discovery.SoapBinding ReadObject_SoapBinding (bool isNullable, bool checkType)
		{
			System.Web.Services.Discovery.SoapBinding ob = null;
			if (isNullable && ReadNull()) return null;

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

			ob = new System.Web.Services.Discovery.SoapBinding ();

			Reader.MoveToElement();

			while (Reader.MoveToNextAttribute())
			{
				if (Reader.LocalName == "binding" && Reader.NamespaceURI == "") {
					ob.@Binding = ToXmlQualifiedName (Reader.Value);
				}
				else if (Reader.LocalName == "address" && Reader.NamespaceURI == "") {
					ob.@Address = Reader.Value;
				}
				else if (IsXmlnsAttribute (Reader.Name)) {
				}
				else {
					UnknownNode (ob);
				}
			}

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

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

			while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) 
			{
				if (Reader.NodeType == System.Xml.XmlNodeType.Element) 
				{
					UnknownNode (ob);
				}
				else
					UnknownNode(ob);

				Reader.MoveToContent();
			}

			ReadEndElement();

			return ob;
		}
Exemplo n.º 5
0
        private void SearchNetworkForWebServers(Dictionary <string, string> WebServiceURLs)
        {
            Cursor.Current = Cursors.WaitCursor;
            string origMessage = ux_textboxLoginMessage.Text;

            ux_textboxLoginMessage.Text    = "Scanning...";
            ux_progressbarScanning.Step    = 1;
            ux_progressbarScanning.Minimum = 0;
            ux_progressbarScanning.Maximum = 255;
            ux_progressbarScanning.Value   = 1;
            ux_progressbarScanning.Show();

            System.Web.Services.Discovery.DiscoveryClientProtocol dcp = new System.Web.Services.Discovery.DiscoveryClientProtocol();
            dcp.Timeout = 1000;

            // Search for active servers hosting the GRIN-Global web services...
            // Try the localhost first...
            try
            {
                ux_textboxLoginMessage.Text = "Scanning localhost...";
                ux_textboxLoginMessage.Update();
                dcp.Discover("http://localhost/GRINGlobal/GUI.asmx");
                WebServiceURLs.Add("localhost", "http://localhost/GRINGlobal/GUI.asmx");
            }
            catch
            {
                // Silently fail...
            }


            // Now scan the class D subnet for all available ethernet adapters...
            System.Net.NetworkInformation.NetworkInterface[] adapters = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();

            foreach (System.Net.NetworkInformation.NetworkInterface adapter in adapters)
            {
                if (adapter.NetworkInterfaceType == System.Net.NetworkInformation.NetworkInterfaceType.Ethernet &&
                    adapter.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up)
                {
                    System.Net.NetworkInformation.IPInterfaceProperties adapterProperties = adapter.GetIPProperties();
                    System.Net.NetworkInformation.UnicastIPAddressInformationCollection adapterAddresses = adapterProperties.UnicastAddresses;
                    foreach (System.Net.NetworkInformation.IPAddressInformation addressInfo in adapterAddresses)
                    {
                        DateTime dtStart       = DateTime.Now;
                        string   addrPrefix    = addressInfo.Address.ToString().Substring(0, addressInfo.Address.ToString().LastIndexOf('.'));
                        string   ipAddress     = addrPrefix + ".1";
                        string   webServiceURL = "http://" + ipAddress + "/GRINGlobal/GUI.asmx";
                        string   serverName    = System.Net.Dns.GetHostEntry(ipAddress).HostName;
                        System.Web.Services.Discovery.DiscoveryDocument dd = new System.Web.Services.Discovery.DiscoveryDocument();

                        for (int addrSuffix = 1; addrSuffix < 254; addrSuffix++)
                        {
                            try
                            {
                                // Now see if we can find a GG server...
                                ipAddress = addrPrefix + "." + addrSuffix;
                                // Display what IP address is being scanned...
                                ux_textboxLoginMessage.Text = "Scanning " + ipAddress + "...";
                                ux_textboxLoginMessage.Update();
                                // Attempt to discover the GG specific web services using the IP address...
                                dd = dcp.Discover("http://" + ipAddress + "/GRINGlobal/GUI.asmx");
                                // If we made it here, we found a webservice so now attempt to resolve the ipAddress to a friendlier host name
                                // Why do this now?  Because DNS lookup can be expensive so only do it when really neccessary
                                // (BTW... unresolved DNS lookups will return the ipAddress)...
                                serverName    = System.Net.Dns.GetHostEntry(ipAddress).HostName;
                                webServiceURL = "http://" + serverName + "/GRINGlobal/GUI.asmx";
                                // Attempt to discover the GG specific web services (again - this time with a DNS resolved computer name)
                                // Why do this?  Because there is a slight possiblity the DNS lookup returned bogus data...
                                dd = dcp.Discover(webServiceURL);
                                for (int i = 0; i < dd.References.Count; i++)
                                {
                                    // There are many different references in a discovery document - we only want the SOAP Bindings...
                                    if (dd.References[i].GetType() == typeof(System.Web.Services.Discovery.SoapBinding))
                                    {
                                        System.Web.Services.Discovery.SoapBinding wsb = (System.Web.Services.Discovery.SoapBinding)dd.References[i];
                                        // The bad news is that the references have duplicates bindings (one for each protocol), but the good
                                        // news is that since the WebServiceURLs object is a dictionary... it will create and execption if the same Key entry is
                                        // attempted to be added twice (net result is that it will silently fail in the catch block)...
                                        WebServiceURLs.Add(serverName, wsb.Address);
                                    }
                                }
                            }
                            catch
                            {
                                // Silently fail...
                            }
                            ux_progressbarScanning.PerformStep();
                            ux_progressbarScanning.Update();
                            // Check to see if we should bail out (at user request)...
                            Application.DoEvents();
                        }
                    }
                }
            }
            ux_progressbarScanning.Hide();
            ux_textboxLoginMessage.Text = origMessage;
        }
        public System.Web.Services.Discovery.SoapBinding ReadObject_SoapBinding(bool isNullable, bool checkType)
        {
            System.Web.Services.Discovery.SoapBinding ob = null;
            if (isNullable && ReadNull())
            {
                return(null);
            }

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

            ob = new System.Web.Services.Discovery.SoapBinding();

            Reader.MoveToElement();

            while (Reader.MoveToNextAttribute())
            {
                if (Reader.LocalName == "binding" && Reader.NamespaceURI == "")
                {
                    ob.@Binding = ToXmlQualifiedName(Reader.Value);
                }
                else if (Reader.LocalName == "address" && Reader.NamespaceURI == "")
                {
                    ob.@Address = Reader.Value;
                }
                else if (IsXmlnsAttribute(Reader.Name))
                {
                }
                else
                {
                    UnknownNode(ob);
                }
            }

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

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

            while (Reader.NodeType != System.Xml.XmlNodeType.EndElement)
            {
                if (Reader.NodeType == System.Xml.XmlNodeType.Element)
                {
                    UnknownNode(ob);
                }
                else
                {
                    UnknownNode(ob);
                }

                Reader.MoveToContent();
            }

            ReadEndElement();

            return(ob);
        }