This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Since your code is working, you might not care but I would like to clarify something.
When you use dynamic proxy, you have no generated code. So, when you use the code service.getPort (Class<T> endpointInterface), YOU need to supply an INTERFACE that the dynamic proxy can implement. This interface must conform to the port type defined in the WSDL. In your case, you were passing a class as opposed to an interface, that's why you got the error. The getPort() method needs an interface, see the API javadoc here.
The easiest way to get the interface is to use the remote interface you have already defined for your EJB. Make sure the interface is packaged with the client and is available in the runtime classpath.
The more interesting questions is, what if you had a POJO based web service? The JAX-WS specification says if [minimally] a class has @WebService annotation, all of its methods must be exposed as a web service and an interface must be generated and used dynamically at runtime. In this scenario, you have no interface. How would you write a client? Or what if your web service is written in .Net and you want to write dynamic client. Where would you get the interface from and how would you invoke the service?
Well, you have two choices: (1) Generate and use static client. In your example, it would generate a class GreeterService.java or something like that. This class will have a method getXYZPort(). You can use this method to get the port and invoke the service on it. (2) Generate code, which among other things will generate an interface. Write a dynamic client and pass this interface to your getPort() method. The limitation in this case would be that you still have to 'generate' client side code.
I consider this issue a lack of completeness in the JAX-WS specification. If the specs allow a POJO web service without an interface, it should also allow a dynamic client without an interface. As long as you pass the port name and namespace, it should automatically generate the endpoint interface at runtime. Unfortunately, that's not how it works.