Ok, after some more digging the problem seems to be the following: If I start up both services on "http://localhost/service" and "http://localhost/service/v2" respectively we can successfully process SOAP requests on "http://localhost/service/v2". When we try to use the other service we get an:
"org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader: Unexpected EOF in prolog". This comes from the the fact that we don't get a valid SOAP-response back but a 302 with location "http://localhost/service/" notice the trailing slash at the end. If we turn on autoredirect on the http conduit it will work. It will also work if we adress the URL using trailing slash directly. Is there a way to not have the built-in Jetty behave like this and treat "/service" and "/service/" the same? Unfortunately we know that some clients out there do not have autoredirect set to true so this change would break for them. Regards, Dang ________________________________ From: God Dang <[email protected]> Sent: Friday, August 26, 2016 1:30 PM To: [email protected] Subject: RE: Problem with multiple ports for one Service Hi Andrei, sorry I wasn't clear in my example, it was even wrong. The problem is when using the same base url, i.e. "http://localhost/service" and "http://localhost/service/v2". It seems as if the url mapping is for the address+anything after it, i.e. "http://localhost/server/*" which overrides "http://localhost/server/v2". I have still not found a solution for this. Regards, Dang ________________________________ Hi, Multiple endpoints are supported out of the box. Take a look into integration tests, for example https://github.com/apache/cxf/blob/master/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerServer.java Server publishes the multiple endpoints. Regards, Andrei. ________________________________ From: [email protected] To: [email protected] Subject: Problem with multiple ports for one Service Date: Mon, 27 Jun 2016 19:00:31 +0000 I'm trying to develop a Server that serves two "services" using different ports in the WSDL, i.e. --- 8< --- <wsdl:service name="Service"> <wsdl:port name="ServicePort-v1" binding="service:ServiceBinding-v1"> <soap:address location="http://uri/Service/v1"/> </wsdl:port> <wsdl:port name="ServicePort-v2" binding="service:ServiceBinding-v2"> <soap:address location="http://uri/Service/v2"/> </wsdl:port> </wsdl:service> --- 8< --- I've implemented two services using: --- 8< --- @WebService ( serviceName = "Service", portName = "ServicePort-v1", wsdlLocation = "WEB-INF/Service.wsdl", targetNamespace = "http://uri/Service") public class MyService1 { ... } --- 8< --- @WebService ( serviceName = "Service", portName = "ServicePort-v2", wsdlLocation = "WEB-INF/Service.wsdl", targetNamespace = "http://uri/Service") public class MyService2 { ... } --- 8< --- And then starting the services using: --- 8< --- final Service1 implementor1 = new Service1(...); final JaxWsServerFactoryBean serverFactoryBean1 = new JaxWsServerFactoryBean(); serverFactoryBean1.setServiceClass(Service1.class); serverFactoryBean1.setAddress(address + "/v1"); serverFactoryBean1.setServiceBean(implementor1); serverFactoryBean1.getServiceFactory().setInvoker(new JAXWSMethodInvoker(implementor1)); Server server1 = serverFactoryBean1.create(); final Service2 implementor2 = new Service2(...); final JaxWsServerFactoryBean serverFactoryBean2 = new JaxWsServerFactoryBean(); serverFactoryBean2.setServiceClass(Service2.class); serverFactoryBean2.setAddress(address + "/v2"); serverFactoryBean2.setServiceBean(implementor2); serverFactoryBean2.getServiceFactory().setInvoker(new JAXWSMethodInvoker(implementor2)); Server server2 = serverFactoryBean2.create(); --- 8< --- But only the second service is working. When I start them one at a time they're working so the underlying implementation is good. I can't seem to find a good way to create a Server that can route on multiple ports(WSDL-ports that is). I've searched long and hard but have yet to find any recent information on how to go about this and would be very grateful for any pointers. Regards, Dang
