jjarrel
11-24-2007, 04:17 AM
I am trying to work out the pattern for instantiating my client side, svcUtil generated proxys.
When a proxy is to be created, I need to create an create an EndPointAddress (service locator type thing) to pass to the ctor of the proxy. Then after the proxy is created, I need to adjust various settings on it like security, buffer size, etc. Then I can send it out, for use.
I don't want the ProxyFactory itself to have any specific reference to the service being instantiated.
Excerpt from ProxyFactory...
public Object Create(String shortName)
{
IApplicationContext context = ContextRegistry.GetContext();
object o = context.GetObject(shortName);
// how to do get this cast
ClientBase<TChannel> proxy = (ClientBase<TChannel>)o;
ResolveCertificate(proxy, "http://jjarrel:8080/someservice");
}
public static void ResolveCertificate<TChannel>(ClientBase<TChannel> proxy, Uri targetService) where TChannel : class
{snip}
Here is where I thought I was going...
<!-- the proxyFactor, which contains an instance method called 'CreateInstance' -->
<object id="proxyFactory"
type="whi.pw.core.webutil.ProxyFactory, whi.pw.core"
lazy-init="true"/>
<object id="eventLog" type="whi.pw.utilscreens.servicereferences.EventLogSvcCl ient, whi.pw.UtilScreens"
singleton="false"
factory-object="proxyFactory"
factory-method ="Create"
>
<constructor-arg name="shortName" value="eventLog"/>
</object>
It appears to me that when I use *my* proxyFactory then the ProxyFactory has to actually instantiate the proxyObject. I'd like to push this back into Spring.
I'd appreciate any suggestions.
Thanks.
jeff
When a proxy is to be created, I need to create an create an EndPointAddress (service locator type thing) to pass to the ctor of the proxy. Then after the proxy is created, I need to adjust various settings on it like security, buffer size, etc. Then I can send it out, for use.
I don't want the ProxyFactory itself to have any specific reference to the service being instantiated.
Excerpt from ProxyFactory...
public Object Create(String shortName)
{
IApplicationContext context = ContextRegistry.GetContext();
object o = context.GetObject(shortName);
// how to do get this cast
ClientBase<TChannel> proxy = (ClientBase<TChannel>)o;
ResolveCertificate(proxy, "http://jjarrel:8080/someservice");
}
public static void ResolveCertificate<TChannel>(ClientBase<TChannel> proxy, Uri targetService) where TChannel : class
{snip}
Here is where I thought I was going...
<!-- the proxyFactor, which contains an instance method called 'CreateInstance' -->
<object id="proxyFactory"
type="whi.pw.core.webutil.ProxyFactory, whi.pw.core"
lazy-init="true"/>
<object id="eventLog" type="whi.pw.utilscreens.servicereferences.EventLogSvcCl ient, whi.pw.UtilScreens"
singleton="false"
factory-object="proxyFactory"
factory-method ="Create"
>
<constructor-arg name="shortName" value="eventLog"/>
</object>
It appears to me that when I use *my* proxyFactory then the ProxyFactory has to actually instantiate the proxyObject. I'd like to push this back into Spring.
I'd appreciate any suggestions.
Thanks.
jeff