Posted by: bgopi | December 3, 2011

add soap header to web service client – simple and elegant way

MyWebService  serviceToUse = new MyWebService();

Object stub = serviceToUse.getPort(new QName(“″,”web-port”), WebPort.class);

WSBindingProvider bp = (WSBindingProvider)stub;
HeaderHandlerResolver handlerResolver = new HeaderHandlerResolver();

myService = serviceToUse.getWebPort();

//call your web method here


For HeaderHandlerResolver and HeaderHandler please refer below:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: