ServiceDescription.PortTypes プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ServiceDescription.PortTypes プロパティの意味・解説 

ServiceDescription.PortTypes プロパティ

ServiceDescription に格納されている PortType 要素コレクション取得します

名前空間: System.Web.Services.Description
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

Public ReadOnly Property
 PortTypes As PortTypeCollection
Dim instance As ServiceDescription
Dim value As PortTypeCollection

value = instance.PortTypes
public PortTypeCollection PortTypes { get;
 }
public:
property PortTypeCollection^ PortTypes {
    PortTypeCollection^ get ();
}
/** @property */
public PortTypeCollection get_PortTypes ()
public function get PortTypes
 () : PortTypeCollection

プロパティ
PortTypeCollection。

解説解説
使用例使用例
Shared Sub Main()
   Dim myWsdlFileName As String
 = "MyWsdl_VB.wsdl"
   Dim myReader As New XmlTextReader(myWsdlFileName)
   If ServiceDescription.CanRead(myReader) Then
      
      Dim myDescription As ServiceDescription
 = _
         ServiceDescription.Read(myWsdlFileName)

      ' Remove the PortType at index 0 of the collection.
      Dim myPortTypeCollection As PortTypeCollection
 = _
         myDescription.PortTypes
      myPortTypeCollection.Remove(myDescription.PortTypes(0))

      ' Build a new PortType.
      Dim myPortType As New
 PortType()
      myPortType.Name = "Service1Soap"
      Dim myOperation As Operation = _
         CreateOperation("Add", "s0:AddSoapIn",
 "s0:AddSoapOut", "")
      myPortType.Operations.Add(myOperation)

      ' Add a new PortType to the PortType collection of 
      ' the ServiceDescription.
      myDescription.PortTypes.Add(myPortType)
      
      myDescription.Write("MyOutWsdl.wsdl")
      Console.WriteLine("New WSDL file generated successfully.")
   Else
      Console.WriteLine("This file is not a WSDL file.")
   End If
End Sub 'Main
 
' Creates an Operation for a PortType.
Public Shared Function CreateOperation(operationName
 As String, _
   inputMessage As String, outputMessage As
 String, _
   targetNamespace As String) As
 Operation

   Dim myOperation As New
 Operation()
   myOperation.Name = operationName
   Dim input As OperationMessage = _
      CType(New OperationInput(), OperationMessage)
   input.Message = New XmlQualifiedName(inputMessage, targetNamespace)
   Dim output As OperationMessage = _
      CType(New OperationOutput(), OperationMessage)
   output.Message = New XmlQualifiedName(outputMessage, targetNamespace)
   myOperation.Messages.Add(input)
   myOperation.Messages.Add(output)
   Return myOperation
End Function 'CreateOperation
static void Main()
{
   string myWsdlFileName ="MyWsdl_CS.wsdl";
   XmlTextReader myReader = new XmlTextReader(myWsdlFileName);
   if (ServiceDescription.CanRead(myReader))
   {
      ServiceDescription myDescription = 
         ServiceDescription.Read(myWsdlFileName);

      // Remove the PortType at index 0 of the collection.
      PortTypeCollection myPortTypeCollection = 
         myDescription.PortTypes;
      myPortTypeCollection.Remove(myDescription.PortTypes[0]);
      
      // Build a new PortType.
      PortType myPortType = new PortType();
      myPortType.Name = "Service1Soap";
      Operation myOperation = 
         CreateOperation("Add","s0:AddSoapIn","s0:AddSoapOut"
,"");
      myPortType.Operations.Add(myOperation);

      // Add a new PortType to the PortType collection of 
      // the ServiceDescription.
      myDescription.PortTypes.Add(myPortType);

      myDescription.Write("MyOutWsdl.wsdl");
      Console.WriteLine("New WSDL file generated successfully.");
   }
   else
   {
      Console.WriteLine("This file is not a WSDL file.");
   }

}
// Creates an Operation for a PortType.
public static Operation CreateOperation(string
 operationName, 
   string inputMessage, string outputMessage,
 string targetNamespace)
{
   Operation myOperation = new Operation();
   myOperation.Name = operationName;
   OperationMessage input = (OperationMessage) new OperationInput();
   input.Message = new XmlQualifiedName(inputMessage,targetNamespace);
   OperationMessage output = (OperationMessage) new OperationOutput();
   output.Message = new XmlQualifiedName(outputMessage,targetNamespace);
   myOperation.Messages.Add(input);
   myOperation.Messages.Add(output);
   return myOperation;
}
// Creates an Operation for a PortType.
Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^
 outputMessage, String^ targetNamespace )
{
   Operation^ myOperation = gcnew Operation;
   myOperation->Name = operationName;
   OperationMessage^ input = dynamic_cast<OperationMessage^>(gcnew OperationInput);
   input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace );
   OperationMessage^ output = dynamic_cast<OperationMessage^>(gcnew OperationOutput);
   output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace );
   myOperation->Messages->Add( input );
   myOperation->Messages->Add( output );
   return myOperation;
}

int main()
{
   String^ myWsdlFileName = "MyWsdl_CS.wsdl";
   XmlTextReader^ myReader = gcnew XmlTextReader( myWsdlFileName );
   if ( ServiceDescription::CanRead( myReader ) )
   {
      ServiceDescription^ myDescription = ServiceDescription::Read( myWsdlFileName
 );

      // Remove the PortType at index 0 of the collection.
      PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes;
      myPortTypeCollection->Remove( myDescription->PortTypes[ 0 ] );

      // Build a new PortType.
      PortType^ myPortType = gcnew PortType;
      myPortType->Name = "Service1Soap";
      Operation^ myOperation = CreateOperation( "Add", "s0:AddSoapIn",
 "s0:AddSoapOut", "" );
      myPortType->Operations->Add( myOperation );

      // Add a new PortType to the PortType collection of 
      // the ServiceDescription.
      myDescription->PortTypes->Add( myPortType );
      myDescription->Write( "MyOutWsdl.wsdl" );
      Console::WriteLine( "New WSDL file generated successfully." );
   }
   else
   {
      Console::WriteLine( "This file is not a WSDL file." );
   }
}
public static void main(String[]
 args)
{
    String myWsdlFileName = "MyWsdl_JSL.wsdl";
    XmlTextReader myReader = new XmlTextReader(myWsdlFileName);
    if (ServiceDescription.CanRead(myReader)) {
        ServiceDescription myDescription = 
            ServiceDescription.Read(myWsdlFileName);
        
        // Remove the PortType at index 0 of the collection.
        PortTypeCollection myPortTypeCollection = 
            myDescription.get_PortTypes();
        myPortTypeCollection.Remove(myDescription.get_PortTypes().
            get_Item(0));
        
        // Build a new PortType.
        PortType myPortType = new PortType();
        myPortType.set_Name("Service1Soap");
        Operation myOperation = 
            CreateOperation("Add", "s0:AddSoapIn", "s0:AddSoapOut",
 "");
        myPortType.get_Operations().Add(myOperation);
        
        // Add a new PortType to the PortType collection of 
        // the ServiceDescription.
        myDescription.get_PortTypes().Add(myPortType);
        myDescription.Write("MyOutWsdl.wsdl");
        Console.WriteLine("New WSDL file generated successfully.");
    }
    else {
        Console.WriteLine("This file is not a WSDL file.");
    }
} //main

// Creates an Operation for a PortType.
public static Operation CreateOperation(String
 operationName, 
    String inputMessage, String outputMessage, String targetNamespace)
{
    Operation myOperation = new Operation();
    myOperation.set_Name(operationName);
    OperationMessage input = (OperationMessage)new OperationInput();
    input.set_Message(new XmlQualifiedName(inputMessage, targetNamespace));
    OperationMessage output = (OperationMessage)new OperationOutput();
    output.set_Message(new XmlQualifiedName(outputMessage, targetNamespace));
    myOperation.get_Messages().Add(input);
    myOperation.get_Messages().Add(output);
    return myOperation;
} //CreateOperation
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ServiceDescription クラス
ServiceDescription メンバ
System.Web.Services.Description 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ServiceDescription.PortTypes プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ServiceDescription.PortTypes プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS