Ejemplo n.º 1
0
        /// <summary>
        /// Register a SOAP delegate.
        /// </summary>
        /// <param name="Hostname">The HTTP hostname.</param>
        /// <param name="URITemplate">The URI template.</param>
        /// <param name="Description">A description of this SOAP delegate.</param>
        /// <param name="SOAPMatch">A delegate to check whether this dispatcher matches the given XML.</param>
        /// <param name="SOAPHeaderAndBodyDelegate">A delegate to process a matching SOAP request.</param>
        public void RegisterSOAPDelegate(HTTPHostname Hostname,
                                         String URITemplate,
                                         String Description,
                                         SOAPMatch SOAPMatch,
                                         SOAPHeaderAndBodyDelegate SOAPHeaderAndBodyDelegate)
        {
            SOAPDispatcher _SOAPDispatcher = null;

            // Check if there are other SOAP dispatchers at the given URI template.
            var _Handler = GetHandler(HTTPHostname.Any,
                                      URITemplate,
                                      HTTPMethod.POST,
                                      ContentTypes => SOAPContentType);

            if (_Handler == null)
            {
                _SOAPDispatcher = new SOAPDispatcher(URITemplate, SOAPContentType);
                _SOAPDispatchers.Add(URITemplate, _SOAPDispatcher);

                // Register a new SOAP dispatcher
                AddMethodCallback(Hostname,
                                  HTTPMethod.POST,
                                  URITemplate,
                                  SOAPContentType,
                                  HTTPDelegate: _SOAPDispatcher.Invoke);

                // Register some information text for people using HTTP GET
                AddMethodCallback(Hostname,
                                  HTTPMethod.GET,
                                  URITemplate,
                                  SOAPContentType,
                                  HTTPDelegate: _SOAPDispatcher.EndpointTextInfo);
            }

            else
            {
                _SOAPDispatcher = _Handler.Target as SOAPDispatcher;
            }


            _SOAPDispatcher.RegisterSOAPDelegate(Description,
                                                 SOAPMatch,
                                                 SOAPHeaderAndBodyDelegate);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Register a SOAP delegate.
        /// </summary>
        /// <param name="Hostname">The HTTP hostname.</param>
        /// <param name="URITemplate">The URI template.</param>
        /// <param name="Description">A description of this SOAP delegate.</param>
        /// <param name="SOAPMatch">A delegate to check whether this dispatcher matches the given XML.</param>
        /// <param name="SOAPHeaderAndBodyDelegate">A delegate to process a matching SOAP request.</param>
        public void RegisterSOAPDelegate(HTTPHostname               Hostname,
                                         String                     URITemplate,
                                         String                     Description,
                                         SOAPMatch                  SOAPMatch,
                                         SOAPHeaderAndBodyDelegate  SOAPHeaderAndBodyDelegate)
        {
            SOAPDispatcher _SOAPDispatcher = null;

            // Check if there are other SOAP dispatchers at the given URI template.
            var _Handler = GetHandler(HTTPHostname.Any,
                                      URITemplate,
                                      HTTPMethod.POST,
                                      ContentTypes => SOAPContentType);

            if (_Handler == null)
            {

                _SOAPDispatcher = new SOAPDispatcher(URITemplate, SOAPContentType);
                _SOAPDispatchers.Add(URITemplate, _SOAPDispatcher);

                // Register a new SOAP dispatcher
                AddMethodCallback(Hostname,
                                  HTTPMethod.POST,
                                  URITemplate,
                                  SOAPContentType,
                                  HTTPDelegate: _SOAPDispatcher.Invoke);

                // Register some information text for people using HTTP GET
                AddMethodCallback(Hostname,
                                  HTTPMethod.GET,
                                  URITemplate,
                                  SOAPContentType,
                                  HTTPDelegate: _SOAPDispatcher.EndpointTextInfo);

            }

            else
                _SOAPDispatcher = _Handler.Target as SOAPDispatcher;

            _SOAPDispatcher.RegisterSOAPDelegate(Description,
                                                 SOAPMatch,
                                                 SOAPHeaderAndBodyDelegate);
        }