CREATE DATABASE Repairs
use Repairs

CREATE LOGIN [Canopus5\MiniDan] FROM WINDOWS

CREATE Function RepairEstimate(@model NVARCHAR(10))
RETURNS INT
AS
BEGIN
RETURN 12
END
	
CREATE USER [Canopus5\MiniDan]
GRANT EXECUTE ON RepairEstimate TO [Canopus5\MiniDan]

EXEC	sp_reserve_http_namespace    
 N'http://Canopus5:80/Repairs/req' 


EXEC	sp_reserve_http_namespace    
 N'http://*:80/Repairs1/req' 





--DROP ENDPOINT RepairPoint

CREATE ENDPOINT RepairPoint
STATE  = Started
AS HTTP
(
 PATH = '/Repairs/req',
 PORTS = (CLEAR),
 SITE = '*',
 AUTHENTICATION = (INTEGRATED)
)
FOR SOAP
(
 WEBMETHOD 'urn:autos'.'GetEstimate'
 (NAME = 'Repairs.dbo.RepairEstimate',
 SCHEMA=STANDARD),
 WSDL=DEFAULT,
 SCHEMA=STANDARD,
 DATABASE = 'Repairs',
 NAMESPACE = 'urn:other'
)

use master
GRANT CONNECT ON ENDPOINT::RepairPoint
 TO [Canopus5\MiniDan]
