We have done this:
| // Static initialization of webservice client
| static protected SendSms stub;
|
| static{
| QName qname = new QName(
| "http://www.csapi.org/wsdl/parlayx/sms/send/v2_2/service",
| "SendSms");
| SendSmsService service = new SendSmsService(null, qname);
| stub = service.getSendSms();
| }
|
|
| @Override
| protected String sendMessage(...params...) throws Exception {
| String response = null;
|
| if (stub==null){
| throw new Exception("There is no stub for SendSms PX 2.1 service
created.");
| }
|
| //Configure stub
| stub.getRequestContext().put(StubExt.PROPERTY_CLIENT_TIMEOUT,1000);
| stub.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ...);
| response = stub.sendSms(...params....);
| return response;
| }
|
|
But I doing tests to see if it is ThreadSafe to do this, or configuring an endpoint on the
stub, will afect other clients sending messages to a previously configured stub in a
previous (but concurrent) call.
In this cases I see that Stub generation only happens in the static initialization, and
this way, performance is much more better.
Am I doing something wrong?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4179980#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...