Java – advantages of using a dynamic client with jax-ws

What are the advantages of using dynamic clients with jax-ws services over using only generated client classes? What are the disadvantages?

**For my particular case, I use Apache CXF, and I'm not sure that other libraries allow "dynamic" clients

– I don't think I need to add this, but... I'm looking for non obvious (I know... Subjective) advantages I don't need to be told not to use generated classes. The advantage is that I don't need to generate classes

Solution

So CXF documentation is very clear about the benefits of dynamic clients:

In other words, you do not need a class definition, as shown in the following document example:

JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient("echo.wsdl");

Object[] res = client.invoke("echo","test echo");
System.out.println("Echo response: " + res[0]);

As for the disadvantages, they are very obvious (which is the price paid): you are manipulating strings and you lose strong typing

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>