Search code examples
javaweb-servicesjax-wscxf

Webservice client, should i keep service or port instance?


I am developing web service client with cxf-codegen-plugin and it is generating class MyService extends Service for client part.
My question now is: when I am creating client, should my MyService object be created each time I want to send request or keep it and each time create Port? Or can I keep Port as well? What is the best way to make client?

Thanks


Solution

  • Keeping the Port around is definitely the best performing option, but keep in mind the thread safety aspects:

    http://cxf.apache.org/faq.html#FAQ-AreJAXWSclientproxiesthreadsafe%3F