public SimpleDeviceHost(ProtocolVersion version) : base(version)
 {
     // Add ServiceNamespace. Set ServiceID and ServiceTypeName
     ServiceNamespace = new WsXmlNamespace("sim", "http://schemas.example.org/SimpleService");
     ServiceID        = "urn:uuid:3cb0d1ba-cc3a-46ce-b416-212ac2419b51";
     ServiceTypeName  = "SimpleDeviceType";
 }
 public HelloWCFService(ProtocolVersion v)
     : base(v)
 {
     // Add ServiceNamespace. Set ServiceID and ServiceTypeName
     ServiceNamespace = new WsXmlNamespace("h", "http://schemas.example.org/HelloWCF");
     ServiceID        = "urn:uuid:3cb0d1ba-cc3a-46ce-b416-212ac2419b51";
     ServiceTypeName  = "HelloWCFDeviceType";
 }
Example #3
0
 public TestDeviceHost(string guid, ProtocolVersion version) : base(version)
 {
     // Add ServiceNamespace. Set ServiceID and ServiceTypeName
     ServiceNamespace =
         new WsXmlNamespace("sim", "http://schemas.example.org/SimpleService");
     ServiceID       = "urn:uuid:" + guid;
     ServiceTypeName = "TestDeviceType";
 }
        // Constructor sets service properties and defines operations
        public AttachmentService(ProtocolVersion version) : base(version)
        {
            // Add ServiceNamespace. Set ServiceID and ServiceTypeName
            ServiceNamespace = new WsXmlNamespace("att", AttNamespace);
            ServiceID        = "urn:uuid:3cb0d1ba-cc3a-46ce-b416-212ac2419b92";
            ServiceTypeName  = "AttachmentService";

            // Add service operations
            ServiceOperations.Add(new WsServiceOperation(AttNamespace, "OneWayAttachment"));
            ServiceOperations.Add(new WsServiceOperation(AttNamespace, "TwoWayAttachmentRequest"));
        }
        // Add MEX namespaces, set the MEX address = to the device address, and adds the
        // Mex service to the internal device hosted service collection.
        private void Init()
        {
            // Set the service type name to internal to hide from discovery services
            ServiceTypeName = "Internal";

            // Set service namespace
            ServiceNamespace = new WsXmlNamespace(WsNamespacePrefix.Wsx, WsWellKnownUri.WsxNamespaceUri);

            // Set the endpoint address
            EndpointAddress = Device.EndpointAddress;

            // Add Discovery service operations
            ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WstNamespaceUri, "Get"));
        }
        public EventingService(ProtocolVersion version) :
            base(version)
        {
            // Set base service properties
            ServiceNamespace = new WsXmlNamespace("eve", "http://schemas.example.org/EventingService");
            ServiceID        = "urn:uuid:cd35d6ba-3e2f-440b-bc2f-b7c375dc6536";
            ServiceTypeName  = "EventingService";

            // Add service types here

            // Add event sources here
            EventSources.Add(new DpwsWseEventSource("eve", "http://schemas.example.org/EventingService", "SimpleEvent"));
            EventSources.Add(new DpwsWseEventSource("eve", "http://schemas.example.org/EventingService", "IntegerEvent"));
            this.AddEventServices();
        }
Example #7
0
        // Constructor sets service properties and adds event sources
        public EventingService(ProtocolVersion version) : base(version)
        {
            // Add ServiceNamespace. Set ServiceID and ServiceTypeName
            ServiceNamespace = new WsXmlNamespace("evnt", "http://schemas.example.org/EventingService");
            ServiceID        = "urn:uuid:3cb0d1ba-cc3a-46ce-b416-212ac2419b91";
            ServiceTypeName  = "EventingService";

            // Add event sources
            EventSources.Add(new DpwsWseEventSource("evnt", "http://schemas.example.org/EventingService", "SimpleEvent"));
            EventSources.Add(new DpwsWseEventSource("evnt", "http://schemas.example.org/EventingService", "IntegerEvent"));
            this.AddEventServices();

            // Start the event simulator
            StartEventSimulator();
        }
Example #8
0
        public HelloWorld(IHelloWorld service)
        {
            // Set the service implementation properties
            m_service = service;

            // Set base service properties
            ServiceNamespace = new WsXmlNamespace("hel", "hello://Microsoft.WCF.Samples.Adapters");
            ServiceID        = "urn:uuid:ade3b12c-b46a-4f8f-8da7-4567e405a2bf";
            ServiceTypeName  = "HelloWorld";

            // Add service types here
            ServiceOperations.Add(new WsServiceOperation("hello://Microsoft.WCF.Samples.Adapters/HelloWorld", "HelloWorld_SayHelloWorld_InputMessageRequest"));

            // Add event sources here
        }
        // Add Ws-Discovery namespaces, set the Discovery service address = to the device address, and adds the
        // Discovery service to the internal device hosted service collection.
        private void Init()
        {
            // Set the service type name to internal to hide from discovery services
            ServiceTypeName = "Internal";

            // Set service namespace
            ServiceNamespace = new WsXmlNamespace("wsd", WsWellKnownUri.WsdNamespaceUri);

            // Set endpoint address
            EndpointAddress = Device.DiscoVersion.WellKnownAddress;

            // Add Discovery service operations
            ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WsdNamespaceUri, "Probe"));
            ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WsdNamespaceUri, "Resolve"));
        }
        public ServiceHelloWCF(IServiceHelloWCF service, ProtocolVersion version) :
            base(version)
        {
            // Set the service implementation properties
            m_service = service;

            // Set base service properties
            ServiceNamespace = new WsXmlNamespace("ser", "http://localhost/ServiceHelloWCF");
            ServiceID        = "urn:uuid:1ef46552-0532-4e74-8c9c-635e126924a1";
            ServiceTypeName  = "ServiceHelloWCF";

            // Add service types here
            ServiceOperations.Add(new WsServiceOperation("http://localhost/ServiceHelloWCF/IServiceHelloWCF", "HelloWCF"));

            // Add event sources here
        }
        public IServiceHelloWCF(IIServiceHelloWCF service, ProtocolVersion version) :
            base(version)
        {
            // Set the service implementation properties
            m_service = service;

            // Set base service properties
            ServiceNamespace = new WsXmlNamespace("ise", "http://localhost/ServiceHelloWCF");
            ServiceID        = "urn:uuid:f4c30207-c2cb-493c-8a44-776c1e0ecc7e";
            ServiceTypeName  = "IServiceHelloWCF";

            // Add service types here
            ServiceOperations.Add(new WsServiceOperation("http://localhost/ServiceHelloWCF/IServiceHelloWCF", "HelloWCF"));

            // Add event sources here
        }
        public AttachmentService(IAttachmentService service, ProtocolVersion version) :
            base(version)
        {
            // Set the service implementation properties
            m_service = service;

            // Set base service properties
            ServiceNamespace = new WsXmlNamespace("att", "http://schemas.example.org/AttachmentService");
            ServiceID        = "urn:uuid:6a97c339-8d5e-4c2e-a8a3-d4d109983c8a";
            ServiceTypeName  = "AttachmentService";

            // Add service types here
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/AttachmentService", "OneWayAttachment"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/AttachmentService", "TwoWayAttachment"));

            // Add event sources here
        }
Example #13
0
        // Constructor sets service properties and defines operations and adds event sources
        public SimpleService(ProtocolVersion version) : base(version)
        {
            // Add ServiceNamespace. Set ServiceID and ServiceTypeName
            ServiceNamespace = new WsXmlNamespace("sim", "http://schemas.example.org/SimpleService");
            ServiceID        = "urn:uuid:3cb0d1ba-cc3a-46ce-b416-212ac2419b90";
            ServiceTypeName  = "SimpleService";

            // Add service operations
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "OneWay"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TwoWayRequest"));

            // Add event sources
            DpwsWseEventSource SimpleEvent = new DpwsWseEventSource("sim", "http://schemas.example.org/EventingService", "SimpleEvent");

            EventSources.Add(SimpleEvent);
            this.AddEventServices();
        }
Example #14
0
        public ISmartService(IISmartService service, ProtocolVersion version) :
            base(version)
        {
            // Set the service implementation properties
            m_service = service;

            // Set base service properties
            ServiceNamespace = new WsXmlNamespace("ism", "http://tempuri.org/");
            ServiceID        = "urn:uuid:72e4b7b5-c0af-48e7-942b-d914719bd38e";
            ServiceTypeName  = "ISmartService";

            // Add service types here
            ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/ISmartService", "GetMeasurements"));
            ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/ISmartService", "CreateMeasurement"));

            // Add event sources here
        }
Example #15
0
        public SimpleService(ISimpleService service)
        {
            // Set the service implementation properties
            m_service = service;

            // Set base service properties
            ServiceNamespace = new WsXmlNamespace("sim", "http://schemas.example.org/SimpleService");
            ServiceID        = "urn:uuid:6fa33842-ab2e-4eeb-b241-4f735013c4ec";
            ServiceTypeName  = "SimpleService";

            // Add service types here
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "OneWay"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TwoWayRequest"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TypeCheckRequest"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "AnyCheckRequest"));

            // Add event sources here
        }
Example #16
0
        public IService1(IIService1 service, ProtocolVersion version) :
            base(version)
        {
            // Set the service implementation properties
            m_service = service;

            // Set base service properties
            ServiceNamespace = new WsXmlNamespace("ise", "http://tempuri.org/");
            ServiceID        = "urn:uuid:4f54ab6d-6094-4a73-b485-cdf6ee8aa116";
            ServiceTypeName  = "IService1";

            // Add service types here
            ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IService1", "getServerAddressWithPort"));
            ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IService1", "keepAlive"));
            ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IService1", "isValid"));

            // Add event sources here
        }
        public SimpleService(ISimpleService service, ProtocolVersion version) :
            base(version)
        {
            // Set the service implementation properties
            m_service = service;

            // Set base service properties
            ServiceNamespace = new WsXmlNamespace("sim", "http://schemas.example.org/SimpleService");
            ServiceID        = "urn:uuid:5b0dd589-9f8c-4c23-b797-01ca3092b1ed";
            ServiceTypeName  = "SimpleService";

            // Add service types here
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "OneWay"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TwoWay"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TypeCheck"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "AnyCheck"));

            // Add event sources here
        }
        //--//

        public DpwsDeviceDiscoService(ProtocolVersion v) : base(v)
        {
            string wsdNamespace = v.DiscoveryNamespace;

            // Set the service type name to internal to hide from discovery services
            ServiceTypeName = "Internal";

            // Set service namespace
            ServiceNamespace = new WsXmlNamespace(WsNamespacePrefix.Wsd, wsdNamespace);

            // Set endpoint address
            EndpointAddress = v.DiscoveryWellKnownAddress;

            // Add Discovery service operations
            ServiceOperations.Add(new WsServiceOperation(wsdNamespace, "Probe"));
            ServiceOperations.Add(new WsServiceOperation(wsdNamespace, "Resolve"));

            m_discovery = new DpwsDeviceDiscovery(v);
        }
Example #19
0
        public TestService(string guid, ProtocolVersion version) : base(version)
        {
            // Add ServiceNamespace. Set ServiceID and ServiceTypeName
            ServiceNamespace = new WsXmlNamespace("sim", "http://schemas.example.org/SimpleService");
            ServiceID        = "urn:uuid:" + guid;
            ServiceTypeName  = "TestService";

            // Add additional namesapces if needed
            // example: Namespaces.Add("someprefix", "http://some/Namespace");

            // Add service operations
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "OneWay"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/SimpleService", "TwoWayRequest"));

            // Add event sources
            DpwsWseEventSource SimpleEvent = new DpwsWseEventSource("sim", "http://schemas.example.org/EventingService", "SimpleEvent");

            EventSources.Add(SimpleEvent);
            this.AddEventServices();
        }
        public IDataAccessService(IIDataAccessService service, ProtocolVersion version) :
            base(version)
        {
            // Set the service implementation properties
            m_service = service;

            // Set base service properties
            ServiceNamespace = new WsXmlNamespace("ida", "http://tempuri.org/");
            ServiceID        = "urn:uuid:358c10f8-ff82-4e9e-977d-236f02d75e7d";
            ServiceTypeName  = "IDataAccessService";

            // Add service types here
            ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IDataAccessService", "GetData"));
            ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IDataAccessService", "SetData"));
            ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IDataAccessService", "SetFileInfo"));
            ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IDataAccessService", "GetNestedData"));
            ServiceOperations.Add(new WsServiceOperation("http://tempuri.org/IDataAccessService", "SetNestedData"));

            // Add event sources here
        }
        public MFTestResults XmlTest_WsXmlNamespace()
        {
            /// <summary>
            /// 1. Gets and verifies each of the properties of a WsXmlNamespace object
            /// 2. Sets and re-verifies all properties
            /// </summary>
            ///

            bool testResult = true;

            try
            {
                WsXmlNamespace testWXN = new WsXmlNamespace("test datum 1", "test datum 2");

                Log.Comment("Prefix");
                if (testWXN.Prefix != null)
                {
                    if (testWXN.Prefix.GetType() !=
                        Type.GetType("System.String"))
                    {
                        throw new Exception("Prefix wrong type");
                    }
                }

                if (testWXN.Prefix.GetType() !=
                    Type.GetType("System.String"))
                {
                    throw new Exception("Prefix wrong type after set");
                }

                if (testWXN.Prefix != "test datum 1")
                {
                    throw new Exception("Prefix wrong data");
                }

                Log.Comment("NamespaceURI");
                if (testWXN.NamespaceURI != null)
                {
                    if (testWXN.NamespaceURI.GetType() !=
                        Type.GetType("System.String"))
                    {
                        throw new Exception("NamespaceURI wrong type");
                    }
                }

                if (testWXN.NamespaceURI.GetType() !=
                    Type.GetType("System.String"))
                {
                    throw new Exception("NamespaceURI wrong type after set");
                }

                if (testWXN.NamespaceURI != "test datum 2")
                {
                    throw new Exception("NamespaceURI wrong data");
                }

                Log.Comment("2 Arg Ctor");
                testWXN = new WsXmlNamespace("test datum 3", "test datum 4");

                Log.Comment("Prefix");
                if (testWXN.Prefix != null)
                {
                    if (testWXN.Prefix.GetType() !=
                        Type.GetType("System.String"))
                    {
                        throw new Exception("Prefix wrong type");
                    }
                }

                if (testWXN.Prefix != "test datum 3")
                {
                    throw new Exception("Prefix wrong data");
                }

                Log.Comment("NamespaceURI");
                if (testWXN.NamespaceURI != null)
                {
                    if (testWXN.NamespaceURI.GetType() !=
                        Type.GetType("System.String"))
                    {
                        throw new Exception("NamespaceURI wrong type");
                    }
                }

                if (testWXN.NamespaceURI != "test datum 4")
                {
                    throw new Exception("NamespaceURI wrong data");
                }
            }
            catch (Exception e)
            {
                testResult = false;
                Log.Comment("Incorrect exception caught: " + e.Message);
            }
            return(testResult ? MFTestResults.Pass : MFTestResults.Fail);
        }