• Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating Port and Stub in static block

 
Ravi Vepanjeri
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!