MyDTO myDTO = new MyDTO();
myDTO.setName("abc");
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(HelloService.class);
factory.setAddress("http://localhost:8087/helloService?wsdl");
HelloService service = (HelloService)factory.create();
service.query(myDTO);
*********************************************
注意,MyDTO继承AbstractDTO抽象类
public class MyDTO extends AbstractDTO{
......
}
**********************************************
结果 myDTO 如果继承抽象类 ,出现了无法实例化User的问题
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unmarshalling Error: Unable to create an instance of com.test.web.AbstractDTO
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
at com.sun.proxy.$Proxy38.query(Unknown Source)
at com.test.web.SoapClient.main(SoapClient.java:24)
Caused by: org.apache.cxf.binding.soap.SoapFault: Unmarshalling Error: Unable to create an instance of com.test.web.AbstractDTO
**********************************************