//--//

        /// <summary>
        /// Creates and instance of the HostedService class.
        /// </summary>
        public DpwsHostedService(ProtocolVersion v)
        {
            m_threadLock        = new object();
            m_endpointRefs      = new WsWsaEndpointRefs();
            m_serviceOperations = new WsServiceOperations();
            m_eventSources      = new DpwsWseEventSources();
            m_prefixCounter     = 0;
            m_blockingCall      = true;
            m_version           = v;
        }
Ejemplo n.º 2
0
        public DpwsMexService(XmlReader reader, ProtocolVersion version)
        {
            reader.ReadStartElement();

            this.EndpointRefs = new WsWsaEndpointRefs();

            while (reader.IsStartElement("EndpointReference", version.AddressingNamespace))
            {
                this.EndpointRefs.Add(new WsWsaEndpointRef(reader, version.AddressingNamespace));
            }

            if (EndpointRefs.Count == 0)
            {
                throw new XmlException(); // must have at least one EndpointReference
            }

            if (reader.IsStartElement("Types", version.WsdpNamespaceUri))
            {
                this.ServiceTypes = new DpwsServiceTypes(reader);
            }

            this.ServiceID = reader.ReadElementString("ServiceId", version.WsdpNamespaceUri);

            XmlReaderHelper.SkipAllSiblings(reader); // xs:any

            reader.ReadEndElement();
        }
Ejemplo n.º 3
0
        public DpwsMexService(XmlReader reader)
        {
            reader.ReadStartElement();

            this.EndpointRefs = new WsWsaEndpointRefs();
            while (
                   (reader.IsStartElement("EndpointReference", WsWellKnownUri.WsaNamespaceUri_2005_08)) ||
                   (reader.IsStartElement("EndpointReference", WsWellKnownUri.WsaNamespaceUri_2004_08)) 
                  )
            {
                this.EndpointRefs.Add(new WsWsaEndpointRef(reader));
            }

            if (EndpointRefs.Count == 0)
            {
                throw new XmlException(); // must have at least one EndpointReference
            }

            if (reader.IsStartElement("Types", WsWellKnownUri.WsdpNamespaceUri))
            {
                this.ServiceTypes = new DpwsServiceTypes(reader);
            }

            this.ServiceID = reader.ReadElementString("ServiceId", WsWellKnownUri.WsdpNamespaceUri);

            XmlReaderHelper.SkipAllSiblings(reader); // xs:any

            reader.ReadEndElement();
        }
Ejemplo n.º 4
0
        public MFTestResults WsaAddressingtest_WsWsaEndpointRefs()
        {
            /// <summary>
            /// 1. Verifies the properties of a WsWsaEndpointRefs object
            /// 2. Adds elements to it
            /// 3. Re-verifies
            /// 4. Empties the object
            /// 5. Re-verifies
            /// </summary>
            ///
            bool testResult = true;
            try
            {
                WsWsaEndpointRefs testWWERs = new WsWsaEndpointRefs();

                if (testWWERs.Count != 0)
                    throw new Exception("Count did not set correctly on new");

                testWWERs.Add(new WsWsaEndpointRef(new System.Uri(WsWellKnownUri.SchemaNamespaceUri)));
                testWWERs.Add(new WsWsaEndpointRef(new System.Uri(WsWellKnownUri.SoapNamespaceUri)));

                if (testWWERs.Count != 2)
                    throw new Exception("Count did not set correctly on new");

                testWWERs.Clear();

                if (testWWERs.Count != 0)
                    throw new Exception("After removing count is not back to zero");


                testWWERs.Add(new WsWsaEndpointRef(new System.Uri(WsWellKnownUri.SchemaNamespaceUri)));
                WsWsaEndpointRef ep = new WsWsaEndpointRef(new System.Uri(WsWellKnownUri.SoapNamespaceUri));
                testWWERs.Add(ep);
                testWWERs.Remove(ep);

                if (testWWERs.Count != 1)
                    throw new Exception("Remove did not correctly remove the item");
            }
            catch (Exception e)
            {
                testResult = false;
                Log.Comment("Incorrect exception caught: " + e.Message);
            }
            return (testResult ? MFTestResults.Pass : MFTestResults.Fail);
        }