SoapServices.IsSoapActionValidForMethodBase 메서드
지정된 SOAPAction이 주어진 MethodBase에 적합한지 여부를 확인합니다.
네임스페이스: System.Runtime.Remoting
어셈블리: mscorlib(mscorlib.dll)
구문
‘선언
Public Shared Function IsSoapActionValidForMethodBase ( _
soapAction As String, _
mb As MethodBase _
) As Boolean
‘사용 방법
Dim soapAction As String
Dim mb As MethodBase
Dim returnValue As Boolean
returnValue = SoapServices.IsSoapActionValidForMethodBase(soapAction, mb)
public static bool IsSoapActionValidForMethodBase (
string soapAction,
MethodBase mb
)
public:
static bool IsSoapActionValidForMethodBase (
String^ soapAction,
MethodBase^ mb
)
public static boolean IsSoapActionValidForMethodBase (
String soapAction,
MethodBase mb
)
public static function IsSoapActionValidForMethodBase (
soapAction : String,
mb : MethodBase
) : boolean
매개 변수
- soapAction
주어진 MethodBase에 대해 확인할 SOAPAction입니다.
- mb
지정된 SOAPAction을 확인할 MethodBase입니다.
반환 값
지정된 SOAPAction이 주어진 MethodBase에 적합하면 true이고, 그렇지 않으면 false입니다.
예외
예외 형식 | 조건 |
---|---|
직접 실행 호출자에 인프라 권한이 없는 경우 |
예제
다음 코드 예제에서는 이 메서드를 사용하는 방법을 보여 줍니다. 이 코드 예제는 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 네임스페이스