public WsdlTemplateBase GetWsdlTemplate(XsdMetadata operations, string baseUri, bool optimizeForFlash, string rawUrl)
		{
			var xsd = new XsdGenerator {
                OperationTypes = operations.GetAllTypes(),
				OptimizeForFlash = optimizeForFlash,
			}.ToString();

			var wsdlTemplate = GetWsdlTemplate();
			wsdlTemplate.Xsd = xsd;
            wsdlTemplate.ReplyOperationNames = operations.GetReplyOperationNames();
            wsdlTemplate.OneWayOperationNames = operations.GetOneWayOperationNames();

			if (rawUrl.ToLower().StartsWith(baseUri))
			{
				wsdlTemplate.ReplyEndpointUri = rawUrl;
				wsdlTemplate.OneWayEndpointUri = rawUrl;
			}
			else
			{
				var suffix = GetType().Name.StartsWith("Soap11") ? "soap11" : "soap12";
				wsdlTemplate.ReplyEndpointUri = baseUri + suffix;
				wsdlTemplate.OneWayEndpointUri = baseUri + suffix;
			}

			return wsdlTemplate;
		}
Ejemplo n.º 2
0
        public WsdlTemplateBase GetWsdlTemplate(XsdMetadata operations, string baseUri, bool optimizeForFlash, string rawUrl, string serviceName)
		{
			var xsd = new XsdGenerator {
                OperationTypes = operations.GetAllTypes(),
				OptimizeForFlash = optimizeForFlash,
			}.ToString();

            var soapFormat = GetType().Name.StartsWith("Soap11", StringComparison.OrdinalIgnoreCase)
                ? Format.Soap11 : Format.Soap12;

			var wsdlTemplate = GetWsdlTemplate();
			wsdlTemplate.Xsd = xsd;
            wsdlTemplate.ServiceName = serviceName;
            wsdlTemplate.ReplyOperationNames = operations.GetReplyOperationNames(soapFormat);
            wsdlTemplate.OneWayOperationNames = operations.GetOneWayOperationNames(soapFormat);
            
            if (rawUrl.ToLower().StartsWith(baseUri))
			{
				wsdlTemplate.ReplyEndpointUri = rawUrl;
				wsdlTemplate.OneWayEndpointUri = rawUrl;
			}
			else
			{
                var suffix = soapFormat == Format.Soap11 ? "soap11" : "soap12";
                wsdlTemplate.ReplyEndpointUri = baseUri + suffix;
				wsdlTemplate.OneWayEndpointUri = baseUri + suffix;
			}

			return wsdlTemplate;
		}
        public WsdlTemplateBase GetWsdlTemplate(ServiceOperations operations, string baseUri, bool optimizeForFlash, bool includeAllTypesInAssembly, string rawUrl)
        {
            var xsd = new XsdGenerator {
                OperationTypes = operations.AllOperations.Types,
                OptimizeForFlash = optimizeForFlash,
                IncludeAllTypesInAssembly = includeAllTypesInAssembly,
            }.ToString();

            var wsdlTemplate = GetWsdlTemplate();
            wsdlTemplate.Xsd = xsd;
            wsdlTemplate.ReplyOperationNames = operations.ReplyOperations.Names;
            wsdlTemplate.OneWayOperationNames = operations.OneWayOperations.Names;

            if (rawUrl.ToLower().Contains("servicestack"))
            {
                //var qsPos = rawUrl.IndexOf('?');
                //var urlWithoutQueryString = qsPos != -1 ? rawUrl.Substring(0, qsPos) : rawUrl;
                wsdlTemplate.ReplyEndpointUri = rawUrl;
                wsdlTemplate.OneWayEndpointUri = rawUrl;
            }
            else
            {
                wsdlTemplate.ReplyEndpointUri = baseUri + "SyncReply.svc";
                wsdlTemplate.OneWayEndpointUri = baseUri + "AsyncOneWay.svc";
            }

            return wsdlTemplate;
        }
        public WsdlTemplateBase GetWsdlTemplate(ServiceOperations operations, string baseUri, bool optimizeForFlash, bool includeAllTypesInAssembly, string rawUrl)
        {
            var xsd = new XsdGenerator {
                OperationTypes = operations.AllOperations.Types,
                OptimizeForFlash = optimizeForFlash,
                IncludeAllTypesInAssembly = includeAllTypesInAssembly,
            }.ToString();

            var wsdlTemplate = GetWsdlTemplate();
            wsdlTemplate.Xsd = xsd;
            wsdlTemplate.ReplyOperationNames = operations.ReplyOperations.Names;
            wsdlTemplate.OneWayOperationNames = operations.OneWayOperations.Names;

            if (rawUrl.ToLower().StartsWith(baseUri))
            {
                wsdlTemplate.ReplyEndpointUri = rawUrl;
                wsdlTemplate.OneWayEndpointUri = rawUrl;
            }
            else
            {
                var suffix = GetType().Name.StartsWith("Soap11") ? "soap11" : "soap12";
                wsdlTemplate.ReplyEndpointUri = baseUri + suffix;
                wsdlTemplate.OneWayEndpointUri = baseUri + suffix;
            }

            return wsdlTemplate;
        }
Ejemplo n.º 5
0
		public void Xsd_output_does_not_contain_xml_declaration()
		{
			var xsd = new XsdGenerator {
				OperationTypes = new[] { typeof(GetCustomer), typeof(GetCustomerResponse), typeof(GetCustomers), typeof(GetCustomersResponse), typeof(StoreCustomer) },
				OptimizeForFlash = false,
			}.ToString();

			Assert.That(!xsd.StartsWith("<?"));
		}
		public static void Main()
		{
			var xsd = new XsdGenerator
			{
				OperationTypes = new[] {
					typeof(GetUsers), typeof(DeleteAllUsers), typeof(StoreNewUser), 
					typeof(GetFactorial), typeof(GetFibonacciNumbers)
				},
				OptimizeForFlash = false,				
			}.ToString();

			Console.WriteLine("xsd: " + xsd);
		}