Beispiel #1
0
 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";
 }
 /// <summary>
 /// Adds an XmlNamespace object to the end of the collection. If the NamespcaeURI is already in the list
 /// it will not be added.
 /// </summary>
 /// <param name="value">The XmlNamespace to be added to the end of the collection. The value can be null.</param>
 /// <returns>The index at which the XmlNamespace has been added.</returns>
 public int Add(WsXmlNamespace value)
 {
     if (Exists(value.Prefix, value.NamespaceURI))
     {
         return(-1);
     }
     return(m_namespaceList.Add(value));
 }
        // 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"));
        }
        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 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"));
        }
        // 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();
        }
        // 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 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
        }
Beispiel #10
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();
        }
        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 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();
        }
        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
        }
        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
        }
        //--//
        
        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);
        }
Beispiel #16
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 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 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
        }
Beispiel #19
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";
 }
Beispiel #20
0
        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);
        }
 /// <summary>
 /// Adds an XmlNamespace object to the end of the collection. If the NamespcaeURI is already in the list
 /// it will not be added.
 /// </summary>
 /// <param name="value">The XmlNamespace to be added to the end of the collection. The value can be null.</param>
 /// <returns>The index at which the XmlNamespace has been added.</returns>
 public int Add(WsXmlNamespace value)
 {
     if (Exists(value.Prefix, value.NamespaceURI))
         return -1;
     return m_namespaceList.Add(value);
 }