Exemplo n.º 1
0
        // 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"));
        }
Exemplo n.º 3
0
        // 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"));
        }
Exemplo n.º 4
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
        }
        public EventingServiceClientProxy(Binding binding, ProtocolVersion version, IEventingServiceCallback callbackHandler) :
            base(binding, version)
        {
            // Set the client callback implementation property
            m_eventHandler = callbackHandler;

            // Set client endpoint address
            m_requestChannel = m_localBinding.CreateClientChannel(new ClientBindingContext(m_version));

            // Add client callback operations and event source types
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/EventingService", "SimpleEvent"));
            EventSources.Add(new DpwsServiceType("SimpleEvent", "http://schemas.example.org/EventingService"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/EventingService", "IntegerEvent"));
            EventSources.Add(new DpwsServiceType("IntegerEvent", "http://schemas.example.org/EventingService"));
        }
        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 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
        }
Exemplo n.º 8
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
        }
        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
        }
Exemplo n.º 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();
        }
Exemplo n.º 11
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
        }
Exemplo n.º 12
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
        }
        //--//

        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);
        }
        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
        }
Exemplo n.º 16
0
        public EventingServiceClientProxy(Binding binding, ProtocolVersion version, IEventingServiceCallback callbackHandler) :
            base(binding, version)
        {
            // Set the client callback implementation property
            m_eventHandler = callbackHandler;

            // Set client endpoint address
            m_requestChannel = m_localBinding.CreateClientChannel(new ClientBindingContext(m_version));

            // Add client callback operations and event source types
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/EventingService", "SimpleEvent"));
            EventSources.Add(new DpwsServiceType("SimpleEvent", "http://schemas.example.org/EventingService"));
            ServiceOperations.Add(new WsServiceOperation("http://schemas.example.org/EventingService", "IntegerEvent"));
            EventSources.Add(new DpwsServiceType("IntegerEvent", "http://schemas.example.org/EventingService"));

            // Add eventing SubscriptionEnd ServiceOperations. By default Subscription End call back to this client
            ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WseNamespaceUri, "SubscriptionEnd"));

            this.StartEventListeners();
        }
Exemplo n.º 17
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();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Creates an instance of a DpwsClient class with a specified eventing callback port number.
        /// </summary>
        public DpwsClient(Binding localBinding, ProtocolVersion v)
        {
            m_threadLock               = new object();
            m_eventClient              = new DpwsEventingClient(v);
            m_mexClient                = new DpwsMexClient(v);
            m_eventCallbacks           = new WsServiceOperations();
            m_callbackServiceEndpoints = new WsServiceEndpoints();
            m_blockingCall             = true;
            m_ignoreRequestFromThisIP  = true;
            m_localBinding             = localBinding;
            m_version = v;

            m_discoClient = new DpwsDiscoveryClient(this, v);

            // Add the Hello and Bye discovery disco services
            ClientDiscoveryService = new DpwsDiscoClientService(this, v);

            // Start a Udp discovery service host
            WsUdpServiceHost.Instance.AddServiceEndpoint(ClientDiscoveryService);
            WsUdpServiceHost.Instance.IgnoreRequestFromThisIP = m_ignoreRequestFromThisIP;
            WsUdpServiceHost.Instance.MaxThreadCount          = 5;
            WsUdpServiceHost.Instance.Start(new ServerBindingContext(v));

            // Add eventing SubscriptionEnd ServiceOperations. By default Subscription End call back
            // to this client
            ServiceOperations.Add(new WsServiceOperation(WsWellKnownUri.WseNamespaceUri, "SubscriptionEnd"));

            // Add callbacks implemented by this client
            m_callbackServiceEndpoints.Add(this);

            // Start the Http service host
            m_httpServiceHost = new WsHttpServiceHost(m_localBinding, m_callbackServiceEndpoints);
            m_httpServiceHost.MaxThreadCount = m_callbackServiceEndpoints.Count;
            m_httpServiceHost.Start(new ServerBindingContext(v));
            System.Ext.Console.Write("Http service host started...");
        }