当前位置: 首页>>代码示例>>C#>>正文


C# WsdlExporter.ExportContract方法代码示例

本文整理汇总了C#中System.ServiceModel.Description.WsdlExporter.ExportContract方法的典型用法代码示例。如果您正苦于以下问题:C# WsdlExporter.ExportContract方法的具体用法?C# WsdlExporter.ExportContract怎么用?C# WsdlExporter.ExportContract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ServiceModel.Description.WsdlExporter的用法示例。


在下文中一共展示了WsdlExporter.ExportContract方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DuplicateContract

		public void DuplicateContract ()
		{
			var label = new TestLabel ("DuplicateContract");

			var cd = new ContractDescription ("MyContract");
			var endpoint = new ServiceEndpoint (
				cd, new BasicHttpBinding (), new EndpointAddress (HttpUri));

			var exporter = new WsdlExporter ();
			exporter.ExportContract (cd);
			exporter.ExportContract (cd);
			exporter.ExportEndpoint (endpoint);

			CheckExport (
				exporter, new QName ("MyContract", "http://tempuri.org/"),
				"BasicHttpBinding", 1, label);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:17,代码来源:ExportTests.cs

示例2: Generate

 public static Wsdl Generate(Type contract)
 {
     var exporter = new WsdlExporter();
     exporter.ExportContract(ContractDescription.GetContract(contract));
     var metadataSet = exporter.GetGeneratedMetadata();
     var schemaStream = new MemoryStream();
     metadataSet.WriteTo(new XmlTextWriter(new StreamWriter(schemaStream)));
     schemaStream.Position = 0;
     var source = XDocument.Load(
         new XmlTextReader(schemaStream));
     return new Wsdl(source);
 }
开发者ID:huoxudong125,项目名称:WCFDoc,代码行数:12,代码来源:Wsdl.cs

示例3: ExportContractExpectException

		//somebody fix this name!
		void ExportContractExpectException (WsdlExporter we, ContractDescription cd, Type exception_type, string msg)
		{
			try {
				we.ExportContract (cd);
			} catch (Exception e) {
				if (e.GetType () == exception_type)
					return;
				Assert.Fail (String.Format ("[{0}] Expected {1}, but got : {2}", msg, exception_type, e));
			}

			Assert.Fail (String.Format ("[{0}] Expected {1}", msg, exception_type));
		}
开发者ID:nlhepler,项目名称:mono,代码行数:13,代码来源:WsdlExporterTest.cs

示例4: ExportBar1Contract

		public void ExportBar1Contract ()
		{
			WsdlExporter we = new WsdlExporter ();
			ContractDescription cd = ContractDescription.GetContract (typeof (Bar1));
			we.ExportContract (cd);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:6,代码来源:WsdlExporterTest.cs

示例5: ExportMexContract

		//FIXME: One check not working, BeginGetResult
		public void ExportMexContract ()
		{
			WsdlExporter we = new WsdlExporter ();
			ContractDescription cd = ContractDescription.GetContract (typeof (IMetadataExchange));
			we.ExportContract (cd);

			MetadataSet ms = we.GetGeneratedMetadata ();

			WSServiceDescription sd = GetServiceDescription (ms, "http://schemas.microsoft.com/2006/04/mex", "ExportMexContract");

			CheckMessage (sd, "IMetadataExchange_Get_InputMessage", "request", "http://schemas.microsoft.com/Message:MessageBody", true, "#exc0");
			CheckMessage (sd, "IMetadataExchange_Get_OutputMessage", "GetResult", "http://schemas.microsoft.com/Message:MessageBody", true, "#exc1");

			//PortType
			PortType port_type = sd.PortTypes ["IMetadataExchange"];
			Assert.IsNotNull (port_type, "#exc2, PortType named IMetadataExchange not found.");

			Assert.AreEqual (1, port_type.Operations.Count, "#exc3");
			Operation op = port_type.Operations [0];
			Assert.AreEqual ("Get", op.Name, "#exc4");

			Assert.AreEqual (2, op.Messages.Count, "#exc5");
			CheckOperationMessage (op.Messages [0], "http://schemas.microsoft.com/2006/04/mex:IMetadataExchange_Get_InputMessage", 
				typeof (OperationInput), "http://schemas.xmlsoap.org/ws/2004/09/transfer/Get");
			
			CheckOperationMessage (op.Messages [1], "http://schemas.microsoft.com/2006/04/mex:IMetadataExchange_Get_OutputMessage", 
				typeof (OperationOutput), "http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse");

			CheckSpecialMessage (ms, "#exc6");

			Assert.AreEqual (1, we.GeneratedWsdlDocuments.Count, "GeneratedWsdlDocuments.Count");
			Assert.AreEqual (1, we.GeneratedXmlSchemas.Count, "GeneratedXmlSchemas.Count");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:34,代码来源:WsdlExporterTest.cs

示例6: ExportMessageContract

		// System.Xml.Schema.XmlSchemaException : XmlSchema error: Named item
		// http://schemas.datacontract.org/2004/07/System.Reflection:ArrayOfTypeInfo was already contained
		// in the schema object table. Consider setting MONO_STRICT_MS_COMPLIANT to 'yes' to mimic
		// MS implementation. Related schema item SourceUri: , Line 0, Position 0.
		public void ExportMessageContract ()
		{
			WsdlExporter we = new WsdlExporter ();
			ContractDescription cd = ContractDescription.GetContract (typeof (IFoo2));
			we.ExportContract (cd);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:WsdlExporterTest.cs

示例7: ExportContract2a

		public void ExportContract2a ()
		{
			WsdlExporter we = new WsdlExporter ();
			we.ExportContract (ContractDescription.GetContract (typeof (IFoo1)));
			//IFoo1a.Op1 is the same operations as IFoo1.Op1, so cant be exported
			//the message element for both is the same
			//(Compared by names not signature)
			ExportContractExpectException (we, ContractDescription.GetContract (typeof (IFoo1a)),
				typeof (InvalidOperationException), "ExportContract2a");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:WsdlExporterTest.cs

示例8: ExportContract2

		public void ExportContract2 ()
		{
			WsdlExporter we = new WsdlExporter ();
			we.ExportContract (ContractDescription.GetContract (typeof (IFoo1)));

			MetadataSet ms = we.GetGeneratedMetadata ();
			Assert.AreEqual (5, ms.MetadataSections.Count);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:WsdlExporterTest.cs

示例9: ExportContract1

		public void ExportContract1 ()
		{
			WsdlExporter we = new WsdlExporter ();
			we.ExportContract (ContractDescription.GetContract (typeof (IEchoService)));

			MetadataSet ms = we.GetGeneratedMetadata ();
			Assert.AreEqual (5, ms.MetadataSections.Count);

			CheckContract_IEchoService (ms, "ExportContract1");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:WsdlExporterTest.cs

示例10: ExportContractInvalid2

		public void ExportContractInvalid2 ()
		{
			WsdlExporter we = new WsdlExporter ();

			we.ExportContract (ContractDescription.GetContract (typeof (IEchoService2)));
			//Invalid as IEchoService3.Echo is http://tempuri.org/Echo message which has already been exported
			//Even though, the service name is different
			ExportContractExpectException (we, ContractDescription.GetContract (typeof (IEchoService3)),
				typeof (InvalidOperationException), "ExportContractInvalid2");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:WsdlExporterTest.cs

示例11: ExportContractInvalid1

		public void ExportContractInvalid1 ()
		{
			WsdlExporter we = new WsdlExporter ();

			we.ExportContract (ContractDescription.GetContract (typeof (IEchoService2)));
		        //Duplicate contract QNames not allowed
			ExportContractExpectException (we, ContractDescription.GetContract (typeof (IEchoService2)),
				typeof (ArgumentException), "ExportContractInvalid1");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:WsdlExporterTest.cs


注:本文中的System.ServiceModel.Description.WsdlExporter.ExportContract方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。