Now my client config is as such :
Code:
<beans>
<bean id="testBeanFactory" class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg>
<list> <value>demo/spring/live/service/employee/impl/beanRef-jaxrpc.xml</value>
</list>
</constructor-arg>
</bean>
</beans>
where beanRef-jaxrpc.xml is set as :
Code:
<beans>
<!--
JAX-RPC wrapper uses default class="org.springframework.remoting.jaxrpc.JaxRpcPortProxyFactoryBean"
-->
<bean id="rrt-employeeAxisWebServiceProxy"
class="demo.spring.live.service.employee.impl.AxisPortProxyFactoryBean">
<property name="serviceFactoryClass">
<value>org.apache.axis.client.ServiceFactory</value>
</property>
<property name="serviceInterface">
<value>demo.spring.live.service.employee.RemoteEmployeeService</value>
</property>
<property name="wsdlDocumentUrl">
<value>file:///C:/eclipse/workspace/RRT_Spring_Live/ant/caller/EmployeeService.wsdl</value>
</property>
<property name="namespaceUri">
<value>http://www.spring.com/RRT/Spring/EmployeeService</value>
</property>
<property name="serviceName">
<value>EmployeeService</value>
</property>
<property name="portName">
<value>EmployeeServicePort</value>
</property>
</bean>
Code:
public class AxisPortProxyFactoryBean extends JaxRpcPortProxyFactoryBean {
protected Log logger = LogFactory.getLog(AxisPortProxyFactoryBean.class.getName());
protected void postProcessJaxRpcService(Service service) {
logger.debug("postProcessJaxRpcService");
TypeMappingRegistry registry = service.getTypeMappingRegistry();
TypeMapping mapping = registry.createTypeMapping();
registerBeanMapping(mapping, EmployeeImpl.class, "EmployeeImpl");
registry.register("http://schemas.xmlsoap.org/soap/encoding/", mapping);
}
protected void registerBeanMapping(TypeMapping mapping, Class type, String name) {
logger.debug("registerBeanMapping");
QName serializerQName = new QName("http://www.sun.com/RRT/Spring/EmployeeService", name);
//QName serializerQName = new QName("http://www.sun.com/RRT/Spring/TO", name);
// QName qName = new QName("http://localhost:8080/rrtSpringLive/services/EmployeeService", name);
mapping.register(type, serializerQName, new BeanSerializerFactory(type, serializerQName), new BeanDeserializerFactory(type, serializerQName));
}
}
The eclipse console shows I really did invoke AxisPortProxyFactoryBean
Code:
07/07/2006 16:03:45 DEBUG [main] demo.spring.live.service.employee.impl.AxisPortProxyFactoryBean.postProcessJaxRpcService(AxisPortProxyFactoryBean.java:45) - postProcessJaxRpcService
07/07/2006 16:03:45 DEBUG [main] demo.spring.live.service.employee.impl.AxisPortProxyFactoryBean.registerBeanMapping(AxisPortProxyFactoryBean.java:78) - registerBeanMapping
07/07/2006 16:03:45 INFO [main] org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor.prepare(JaxRpcPortClientInterceptor.java:325) - Creating JAX-RPC proxy for JAX-RPC port [{http://www.spring.com/RRT/Spring/EmployeeService}EmployeeServicePort], using port interface [demo.spring.live.service.employee.RemoteEmployeeService]
07/07/2006 16:03:45 INFO [main] org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor.prepare(JaxRpcPortClientInterceptor.java:333) - Using service interface [demo.spring.live.service.employee.RemoteEmployeeService] for JAX-RPC port [{http://www.spring.com/RRT/Spring/EmployeeService}EmployeeServicePort] - directly implemented
07/07/2006 16:03:45 DEBUG [main] demo.spring.live.service.employee.impl.RemoteEmployeeServiceJaxRpcClientSpringTestCase.testCreateEmployee(RemoteEmployeeServiceJaxRpcClientSpringTestCase.java:120) - testCreateEmployee
07/07/2006 16:03:45 DEBUG [main] demo.spring.live.service.employee.impl.RemoteEmployeeServiceJaxRpcClient.createEmployee(RemoteEmployeeServiceJaxRpcClient.java:43) - createEmployee
07/07/2006 16:03:45 DEBUG [main] org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor.invoke(JaxRpcPortClientInterceptor.java:495) - Invoking operation 'createEmployee' on JAX-RPC port stub
Tomcat console shows I have reached EmployeeServiceEndPoint.onInit but not not the expected method (createEmployee)
JUnit stack trace error displays :
java.lang.reflect.UndeclaredThrowableException
...
Caused by: No such operation 'employee'
Last point is the same as seen at http://forum.springframework.org/showthread.php?t=13335 , I had to set up the WSDL URL with file://, as an HTTP URL caused an error when I set the default generated EmployeeAxisBindingSkeleton in server-config.wsdd, now that server-config.wsdd is set with EmployeeServiceEndPoint, on the client-side I can set the WSDL URL with HTTP but got an error :
Code:
org.springframework.beans.factory.access.BootstrapException: Unable to initialize group definition. Group resource name [classpath*:demo/spring/live/service/employee/impl/beanRefFactory.xml], factory key [testBeanFactory]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testBeanFactory' defined in URL [file:/C:/eclipse/workspace/RRT_Spring_Live/bin/demo/spring/live/service/employee/impl/beanRefFactory.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rrt-employeeAxisWebServiceProxy' defined in class path resource [demo/spring/live/service/employee/impl/beanRef-jaxrpc.xml]: Initialization of bean failed; nested exception is javax.xml.rpc.ServiceException: Error processing WSDL document:
java.io.IOException: Type {http://employee.domain.live.spring.demo}Employee is referenced but not defined.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testBeanFactory' defined in URL [file:/C:/eclipse/workspace/RRT_Spring_Live/bin/demo/spring/live/service/employee/impl/beanRefFactory.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rrt-employeeAxisWebServiceProxy' defined in class path resource [demo/spring/live/service/employee/impl/beanRef-jaxrpc.xml]: Initialization of bean failed; nested exception is javax.xml.rpc.ServiceException: Error processing WSDL document:
java.io.IOException: Type {http://employee.domain.live.spring.demo}Employee is referenced but not defined.
org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.context.support.ClassPathXmlApplicationContext]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rrt-employeeAxisWebServiceProxy' defined in class path resource [demo/spring/live/service/employee/impl/beanRef-jaxrpc.xml]: Initialization of bean failed; nested exception is javax.xml.rpc.ServiceException: Error processing WSDL document:
java.io.IOException: Type {http://employee.domain.live.spring.demo}Employee is referenced but not defined.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rrt-employeeAxisWebServiceProxy' defined in class path resource [demo/spring/live/service/employee/impl/beanRef-jaxrpc.xml]: Initialization of bean failed; nested exception is javax.xml.rpc.ServiceException: Error processing WSDL document:
java.io.IOException: Type {http://employee.domain.live.spring.demo}Employee is referenced but not defined.
javax.xml.rpc.ServiceException: Error processing WSDL document:
java.io.IOException: Type {http://employee.domain.live.spring.demo}Employee is referenced but not defined.
at org.apache.axis.client.Service.initService(Service.java:250)
at org.apache.axis.client.Service.<init>(Service.java:165)
Tomcat server console displays :
Code:
07/07/2006 16:23:54 WARN [http-8080-Processor25] org.apache.axis.wsdl.fromJava.Emitter.writePartToMessage(Emitter.java:1907) - Please register a typemapping/b
eanmapping for 'demo.spring.live.domain.employee.Employee'
07/07/2006 16:23:54 WARN [http-8080-Processor25] org.apache.axis.wsdl.fromJava.Types.isBeanCompatible(Types.java:1704) - The class demo.spring.live.domain.employee.Employee does not contain a default constructor, which is a requirement for a bean class. The class cannot be converted into an xml schema ty
pe. An xml schema anyType will be used to define this class in the wsdl file.
07/07/2006 16:23:54 WARN [http-8080-Processor25] org.apache.axis.wsdl.fromJava.Emitter.writePartToMessage(Emitter.java:1907) - Please register a typemapping/b
eanmapping for 'demo.spring.live.domain.employee.Employee'
Any Gotcha else to know ?
Many thanks