사용자 지정 ServiceBehavior를 작성합니다. 요청 메시지의 유형을 알면 메시지가 맞춤 속성 내가 사용하여 행동 측의 사용자 지정 특성을 식별하기 위해 노력하고WCF 서비스의 서비스 동작에서 요청 메시지의 형식을 가져 오는 방법
[DataContract]
[Auditable]
public class CompositeType
{
bool boolValue = true;
string stringValue = "Hello ";
[DataMember]
[Audit]
public bool BoolValue
{
get { return boolValue; }
set { boolValue = value; }
}
[DataMember]
[Audit]
public string StringValue
{
get { return stringValue; }
set { stringValue = value; }
}
}
:
처럼 내 샘플 계약은 볼 수 있었다
public object AfterReceiveRequest(ref Message request, IClientChannel channel,
InstanceContext instanceContext)
{
var typeOfRequest = request.GetType();
if (!typeOfRequest.GetCustomAttributes(typeof (AuditableAttribute), false).Any())
{
return null;
}
}
을하지만 typeOfRequest은 항상로오고있다 a {Name = "BufferedMessage"FullName = "System.ServiceModel.Channels.BufferedMessage"}
요청을 사용하여 메시지 유형을 추론 할 수있는 방법이 있습니까?
참고 : 계약서를 보유하고있는 어셈블리에 대한 직접적인 참조는 wsdl을 통해 참조되지 않습니다.
않는 서비스 이용 SOAP : 우리가 뭔가를 할 수있는 BeforeCall 방법에
? – lockstock예 SOAP 메시지를 사용하여 통신합니다. – Dibyendu
SOAP 메시지를 검사하여 요청 내에서 직렬화되는 오브젝트를 판별 할 수 있습니다. 그런데 서비스에서 역 직렬화되기 전에 메시지에서 정의 된 유형을 결정하려고하는 이유는 무엇입니까? – lockstock