-
Copying of custom attributes doesn't work for ServiceBehavior Wcf attribute and AOP
Alex, Bruno,
I followed the discussion on this forum about attributes being copied and currently I'm investigating the following issue:
When we create an aoped instance of the WebService class (which is as well Wcf service) via WebserviceExporter we are getting ArgumentNullException in the GetCustomAttributes method for ServiceBehavior attribute (ConfigurationName can't be null).
You can reproduce the problem in the following way (no need for webservice):
IWcfService service = new WcfServiceImpl();
ProxyFactory pf1 = new ProxyFactory(service);
pf1.AddAdvisor(new DefaultPointcutAdvisor(new NopInterceptor()));
IWcfService proxy0 = pf1.GetProxy() as IWcfService;
Assert.IsNotNull(proxy0, "pf1.GetProxy() as IWcfService should not evaluate as null!");
ProxyFactory pf2 = new ProxyFactory(pf1.GetProxy());
pf2.AddAdvisor(new DefaultPointcutAdvisor(new NopInterceptor()));
IWcfService proxy1 = pf2.GetProxy() as IWcfService;
It is second .GetProxy that is leading to the exception when attributes are copied not from the original type but from the proxy of the original class.
for the sample class as:
[ServiceBehavior(Name = "WcfServiceWithServiceBehavior", Namespace = "http://spring.net/wcf.tests/2006")]
public class WcfServiceImpl : IWcfService
{
public string WcfMethod(int count)
{
return count.ToString();
}
}
We are commited to fix the problem, though when I see the code where exception is hapenning:
protected virtual IList GetTypeAttributes(Type type)
{
// TODO : attributes override
ArrayList attributes = new ArrayList();
if (this.ExposeTargetAttributes)
{
// add attributes that apply to the target type
attributes.AddRange(type.GetCustomAttributes(false ));
}
reading the forums and seeing this TODO in the code, I'd like to discuss what is your vision for fixing this problem before we apply our solution.
You can be on Spring.One I guess
Then my java Spring collegue may try to contact you there.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules