问题描述
如何在tomcat而非Jetty服务器上部署 CXF SOAP Web服务
如果我尝试使用tomcat端口运行ServerFactoryBean
,则显示错误:
端口已在运行。
是否可以使用tomcat代替内置码头服务器?
以下是我尝试创建服务器的代码。
SoapBindingFactory bindingFactory = new SoapBindingFactory();
Bus bus = BusFactory.newInstance().createBus();
bindingFactory.setBus(bus);
bus.getExtension(BindingFactoryManager.class).registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/",bindingFactory);
bus.getExtension(BindingFactoryManager.class).registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/http",bindingFactory);
Service service = new WSDLServiceFactory(bus,"wsdl path here",null).create();
ServerFactoryBean serverFactory = new ServerFactoryBean();
serverFactory.setBus(bus);
InboundRMHttpInvoker invoker = new InboundRMHttpInvoker(serviceImpl);
serverFactory.setInvoker(invoker);
serverFactory.setServiceBean(serviceImpl);
serverFactory.setDataBinding(service.getDataBinding());
serverFactory.setServiceName(service.getName());
serverFactory.setBindingId(service.getServiceInfos().get(0).getBindings().iterator().next().getBindingId());
serverFactory.setWsdlLocation("wsdl path");
serverFactory.setEndpointName(service.getServiceInfos().iterator().next().getEndpoints().iterator().next().getName());
serverFactory.setAddress("http://localhost:8080/services/sampleservice");
Server server = serverFactory.create();
如果我使用其他端口(tomcat除外),它将在该端口上部署我的服务,但是如何在tomcat端口上运行它。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)