Webservice客户端,我应该保留服务或端口实例吗? [英] Webservice client, should i keep service or port instance?
问题描述
i正在使用cxf codegen开发Web服务客户端,并为客户端部分生成类 MyService extends Service
。
My现在的问题是当我创建客户端时,应该是每次我想发送请求时创建的MyService对象还是保留它并且每次创建端口?或者我可以保留港口吗?制作客户的最佳方式是什么?
i am developing web service client with cxf codegen and it generating class MyService extends Service
for client part.
My question now is when i am creating client, should be MyService object created each time i want 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?
谢谢
推荐答案
保持港口周围绝对是最佳性能选择,但请记住线程安全方面:
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
这篇关于Webservice客户端,我应该保留服务或端口实例吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!