• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Creating Port and Stub in static block

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hai,

I need to write a web service client for a web service, which was developed using weblogic servicegen ant task. I wrote a web service client to invoke the web service but it is taking nearly 200ms to create port and stub. Please find the below code..

client = new GetECoupon_Impl().getGetECouponPort();
GetECouponPort_Stub stub=(GetECouponPort_Stub) client;
((Stub) stub)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, webserviceURL);
Object responsearray[] = client.getECoupons(req);

To optimize the above code i moved teh port and stub assignment to a static block as shown below..

static {
client = new GetECoupon_Impl().getGetECouponPort();
GetECouponPort_Stub stub=(GetECouponPort_Stub) client;
((Stub) stub)._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, webserviceURL);
}
:
:
Object responsearray[] = client.getECoupons(req);
:

Can anyone let me if there is any issue in move the code to static block? Please share your experience if you have implemented the same..

*i have removed unnecessary try catch blocks to avoid confusion

Thanks & Regards,
Ravi
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic