I have a CXF webservice that I need to now host in Tomcat webapp. I'm
using the 'code first' approach where I have Java pojos, annotated for CXF
webservice, e.g.
@WebService()
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use =
SOAPBinding.Use.LITERAL)
@XmlJavaTypeAdapter(WebServiceAPIAdapter.class)
public interface IWebServiceAPI {
public WebOutput calc(@WebParam(name = "webInput") WebInput webInput);
}
Which previously I hosted in standalone Jetty server, e.g.
WebServiceAPI implementor = new WebServiceAPI();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(IWebServiceAPI.class);
svrFactory.setAddress("http://IP:port/namespace");
svrFactory.setServiceBean(implementor);
server = svrFactory.create();
That all works well but now I need to do the same in Tomcat, so I assume
the code and @WebService annotation is the same? But how do I now
host/deploy this in war? E.g. I don't need any server with IP address/etc.
Rather I want to deploy in war so IP:port is already defined by the
container just need the rest of this.
How do I transition to Tomcat/war?
Also I might mention that I need the resulting auto generated WSDL to
generate schema for the WebOutput result object as that is a nested Java
POJO...again this works fine in standalone Jetty server just need the same
in war.