I'm trying to create a standard Java 5 Proxy of my service classes and can't
get it to work.
I've tried several approaches, does anyone have any insight about what is
going wrong?
In both approaches, I'm creating a standard Java 5 Proxy out of the service
class and an InvocationHandler. To make this easy in the Spring config I
wrote a little type safe Proxy utility:
public class ProxyUtils {
public static <T> T makeProxy(InvocationHandler handler, Class<T>
clazz) {
return clazz.cast(
Proxy.newProxyInstance(
clazz.getClassLoader(),
new Class[]{clazz},
handler)
);
}
Also, in both approaches there are "SystemParameterService" and
"SystemParameterServiceImpl" as the service class.
Approach #1 - Define an "implementorClass" on jaxws:endpoint - Results in
error "java.lang.IllegalArgumentException: object is not an instance of
declaring class" error.
I defined my endpoint with an implementorClass like so:
<jaxws:endpoint id="systemParameter"
implementor="#systemParameterService"
implementorClass="vue.tcsm.services.SystemParameterService"
address="/SystemParameterService">
</jaxws:endpoint>
Then I just created a proxy of the service class:
<bean id="systemParameterService" scope="prototype"
class="vue.tcsm.services.ProxyUtils" factory-method="makeProxy">
<constructor-arg>
<bean
class="vue.tcsm.services.VueSystemAppUserBeforeAdvice"
scope="prototype">
<constructor-arg>
<bean
class="vue.tcsm.services.SystemParameterServiceImpl"
scope="prototype"/>
</constructor-arg>
</bean>
</constructor-arg>
<constructor-arg
value="vue.tcsm.services.SystemParameterService" />
</bean>
The Exception comes out of JAXWSMethodInvoker and kind of makes sense. The
service class is a Proxy and not a SystemParameterService, so I understand
the message. Is there a way to make this approach work?
Approach #2 - Don't Define an "implementorClass" - results in
"org.apache.cxf.interceptor.Fault: Message part {http://cxf.example/}xxx was
not recognized. (Does it exist in service WSDL?)"
In this approach I simply dropped off the "implementorClass" attribute. This
results in the WSDL not being generated correctly and this exception.
Is there a way to use Java 5 Proxy with CXF?
Thanks,
-----
--
Hamlet D'Arcy
--
View this message in context:
http://www.nabble.com/Can%27t-Proxy-Service-classes-tp25648984p25648984.html
Sent from the cxf-user mailing list archive at Nabble.com.