本文整理汇总了C#中System.Web.Services.Description.Operation类的典型用法代码示例。如果您正苦于以下问题:C# Operation类的具体用法?C# Operation怎么用?C# Operation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Operation类属于System.Web.Services.Description命名空间,在下文中一共展示了Operation类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//引入命名空间
using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;
class MyOperationClass
{
public static void Main()
{
ServiceDescription myDescription = ServiceDescription.Read("Operation_5_Input_CS.wsdl");
// Create a 'PortType' object.
PortType myPortType = new PortType();
myPortType.Name = "OperationServiceHttpPost";
Operation myOperation = CreateOperation
("AddNumbers","s0:AddNumbersHttpPostIn","s0:AddNumbersHttpPostOut");
myPortType.Operations.Add(myOperation);
// Get the PortType of the Operation.
PortType myPort = myOperation.PortType;
Console.WriteLine(
"The port type of the operation is: " + myPort.Name);
// Add the 'PortType's to 'PortTypeCollection' of 'ServiceDescription'.
myDescription.PortTypes.Add(myPortType);
// Write the 'ServiceDescription' as a WSDL file.
myDescription.Write("Operation_5_Output_CS.wsdl");
Console.WriteLine("WSDL file with name 'Operation_5_Output_CS.wsdl' file created Successfully");
}
public static Operation CreateOperation(string myOperationName,string myInputMesg,string myOutputMesg)
{
// Create an Operation.
Operation myOperation = new Operation();
myOperation.Name = myOperationName;
OperationMessage myInput = (OperationMessage)new OperationInput();
myInput.Message = new XmlQualifiedName(myInputMesg);
OperationMessage myOutput = (OperationMessage)new OperationOutput();
myOutput.Message = new XmlQualifiedName(myOutputMesg);
// Add messages to the OperationMessageCollection.
myOperation.Messages.Add(myInput);
myOperation.Messages.Add(myOutput);
Console.WriteLine("Operation name is: " + myOperation.Name);
return myOperation;
}
}