@Test
public void testMyWebService() {
MyWebServiceImpl endpoint = new MyWebServiceImpl ();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(MyWebServiceInterface.class);
svrFactory.setAddress("http://localhost:9000/myService");
svrFactory.setServiceBean(endpoint);
svrFactory.create();
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(MyWebServiceInterface.class);
factory.setAddress("http://localhost:9000/myService");
MyWebServiceInterface client = (MyWebServiceInterface) factory.create();
List
Assert.assertNotNull(details);
}
That's it! This will bootstrap an actual JAXWS version of your service within your JVM and hit it with a real CXF client. One thing you have to make sure of, if you are running tests on a CI server be sure to use a port which is not in use on that build box.
Great example!
ReplyDelete(You may also have to add cxf-rt-transports-http-jetty)
i have similar requirement but am stuck
ReplyDelete