SoapServices.GetSoapActionFromMethodBase 메서드
주어진 MethodBase에 지정된 메서드와 관련된 SOAPAction 값을 반환합니다.
네임스페이스: System.Runtime.Remoting
어셈블리: mscorlib(mscorlib.dll)
구문
‘선언
Public Shared Function GetSoapActionFromMethodBase ( _
mb As MethodBase _
) As String
‘사용 방법
Dim mb As MethodBase
Dim returnValue As String
returnValue = SoapServices.GetSoapActionFromMethodBase(mb)
public static string GetSoapActionFromMethodBase (
MethodBase mb
)
public:
static String^ GetSoapActionFromMethodBase (
MethodBase^ mb
)
public static String GetSoapActionFromMethodBase (
MethodBase mb
)
public static function GetSoapActionFromMethodBase (
mb : MethodBase
) : String
매개 변수
- mb
SOAPAction을 요청할 메서드가 들어 있는 MethodBase입니다.
반환 값
주어진 MethodBase에 지정된 메서드와 관련된 SOAPAction 값입니다.
예외
예외 형식 | 조건 |
---|---|
직접 실행 호출자에 인프라 권한이 없는 경우 |
설명
주어진 MethodBase가 SOAPAction 값에 등록되지 않은 경우 GetSoapActionFromMethodBase 메서드는 MethodBase를 통해 자동으로 캐시된 SOAPAction을 반환합니다.
예제
다음 코드 예제에서는 이 메서드를 사용하는 방법을 보여 줍니다. 이 코드 예제는 SoapServices 클래스에 대해 제공되는 보다 큰 예제의 일부입니다.
// Get the SOAP action for the method.
System.Reflection.MethodBase getHelloMethodBase =
typeof(ExampleNamespace.ExampleClass).GetMethod("GetHello");
string getHelloSoapAction =
SoapServices.GetSoapActionFromMethodBase(getHelloMethodBase);
Console.WriteLine(
"The SOAP action for the method " +
"ExampleClass.GetHello is {0}.", getHelloSoapAction);
bool isSoapActionValid = SoapServices.IsSoapActionValidForMethodBase(
getHelloSoapAction,
getHelloMethodBase);
if (isSoapActionValid)
{
Console.WriteLine(
"The SOAP action, {0}, " +
"is valid for ExampleClass.GetHello",
getHelloSoapAction);
}
else
{
Console.WriteLine(
"The SOAP action, {0}, " +
"is not valid for ExampleClass.GetHello",
getHelloSoapAction);
}
// Register the SOAP action for the GetHello method.
SoapServices.RegisterSoapActionForMethodBase(getHelloMethodBase);
// Get the type and the method names encoded into the SOAP action.
string encodedTypeName;
string encodedMethodName;
SoapServices.GetTypeAndMethodNameFromSoapAction(
getHelloSoapAction,
out encodedTypeName,
out encodedMethodName);
Console.WriteLine(
"The type name encoded in this SOAP action is {0}.",
encodedTypeName);
Console.WriteLine(
"The method name encoded in this SOAP action is {0}.",
encodedMethodName);
// Get the SOAP action for the method.
System::Reflection::MethodBase^ getHelloMethodBase =
ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" );
String^ getHelloSoapAction =
SoapServices::GetSoapActionFromMethodBase( getHelloMethodBase );
Console::WriteLine( L"The SOAP action for the method "
L"ExampleClass.GetHello is {0}.", getHelloSoapAction );
bool isSoapActionValid =
SoapServices::IsSoapActionValidForMethodBase(
getHelloSoapAction, getHelloMethodBase );
if ( isSoapActionValid )
{
Console::WriteLine( L"The SOAP action, {0}, "
L"is valid for ExampleClass.GetHello", getHelloSoapAction );
}
else
{
Console::WriteLine( L"The SOAP action, {0}, "
L"is not valid for ExampleClass.GetHello", getHelloSoapAction );
}
// Register the SOAP action for the GetHello method.
SoapServices::RegisterSoapActionForMethodBase( getHelloMethodBase );
// Get the type and the method names encoded into the SOAP action.
String^ encodedTypeName;
String^ encodedMethodName;
SoapServices::GetTypeAndMethodNameFromSoapAction(
getHelloSoapAction,encodedTypeName,encodedMethodName );
Console::WriteLine( L"The type name encoded in this SOAP action is {0}.",
encodedTypeName );
Console::WriteLine( L"The method name encoded in this SOAP action is {0}.",
encodedMethodName );
// Get the SOAP action for the method.
System.Reflection.MethodBase getHelloMethodBase = ExampleNamespace.
ExampleClass.class.ToType().GetMethod("GetHello");
String getHelloSoapAction = SoapServices.
GetSoapActionFromMethodBase(getHelloMethodBase);
Console.WriteLine("The SOAP action for the method "
+ "ExampleClass.GetHello is {0}.", getHelloSoapAction);
boolean isSoapActionValid = SoapServices.
IsSoapActionValidForMethodBase(getHelloSoapAction,
getHelloMethodBase);
if (isSoapActionValid) {
Console.WriteLine("The SOAP action, {0}, "
+ "is valid for ExampleClass.GetHello", getHelloSoapAction);
}
else {
Console.WriteLine("The SOAP action, {0}, "
+ "is not valid for ExampleClass.GetHello", getHelloSoapAction);
}
// Register the SOAP action for the GetHello method.
SoapServices.RegisterSoapActionForMethodBase(getHelloMethodBase);
// Get the type and the method names encoded into the SOAP action.
String encodedTypeName = "";
String encodedMethodName = "";
SoapServices.GetTypeAndMethodNameFromSoapAction(getHelloSoapAction,
encodedTypeName, encodedMethodName);
Console.WriteLine("The type name encoded in this SOAP action is {0}.",
encodedTypeName);
Console.WriteLine("The method name encoded in this SOAP action is {0}.",
encodedMethodName);
.NET Framework 보안
- SecurityPermission 인프라 코드를 사용하여 작업하는 데 필요한 권한입니다. 연관된 열거형: SecurityPermissionFlag.Infrastructure
플랫폼
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원
참고 항목
참조
SoapServices 클래스
SoapServices 멤버
System.Runtime.Remoting 네임스페이스