Пример #1
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("<?"));
		}
Пример #2
0
        /// <summary>Gets wsdl template.</summary>
        ///
        /// <param name="operations">      The operations.</param>
        /// <param name="baseUri">         URI of the base.</param>
        /// <param name="optimizeForFlash">true to optimize for flash.</param>
        /// <param name="rawUrl">          URL of the raw.</param>
        /// <param name="serviceName">     Name of the service.</param>
        ///
        /// <returns>The wsdl template.</returns>
        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;
        }