ServiceFactory serviceFactory = ServiceFactory.newInstance(); Service wsService = serviceFactory.createService(wsdlUrl,new QNameaDefNameSpaceURI, aServiceName));
My question is that ServiceFactory is an abstract class and createService is a abstract method, does it need to be implemented somewhere? I can understand in the Axis context because it uses org.apache.axis.client.ServiceFactory which extends javax.xml.rpc.ServiceFactory and has its implementation of createService().But where is the implementation in JAX-RPC context?
Joined: Mar 22, 2005
Welcome to JavaRanch.
You're right, the method needs to be implemented somewhere, but that's abstracted away from the user/programmer, as far as JAX-RPC is concerned. The javadocs say "The ServiceFactory implementation class is set using the system property SERVICEFACTORY_PROPERTY.", and any actual client implementation would set that to whatever class extends ServiceFactory. Even if you program to the JAX-RPC API, you're still using the Axis client classes. Or you can use some other client implementation if you prefer. The important point is that you can switch implementations without having to change your source code.