I am using JWSDP-1.5 and XWS to implement a web service. Everything works
fine so long as I only call a single web service. However, if I call two
different web services, things break because the CallbackHandler is not
called on every web service call. When I switch try to call the second web
service it is using the username and password from the first service.
The sequence of events goes something like this:
ServicePort.setUsername("test"); //sets a static thread-local variable to
the proper username
ServicePort.setPassword("testpw"); //sets a static thread-local variable to
the proper password
//The callback handler will retrieve the username and password from these
static variables
myStub = (ReceivershipServicePortType_Stub) new
ReceivershipService_Impl().getReceivershipPort();
myStub._setProperty(
com.sun.xml.rpc.client.StubBase.ENDPOINT_ADDRESS_PROPERTY,myEndpoint);
ServicePing sp = new ServicePing();
sp.setEcho(echo);
ServicePingReturn rc = myStub.servicePing(sp);
//now ping the second service
ServicePort.setUsername("test"); //sets a static thread-local variable to
the proper username
ServicePort.setPassword("testpw"); //sets a static thread-local variable to
the proper password
myStub._setProperty(
com.sun.xml.rpc.client.StubBase.ENDPOINT_ADDRESS_PROPERTY,myOtherEndpoint);
sp = new ServicePing();
sp.setEcho(echo);
//call the new web service, should invoke the CallbackHandler, but it does
not. Instead it attempts to re-use the
//values from teh old webservice.
ServicePingReturn rc2 = myStub.servicePing(sp);
// end-code
How can I force the security framework to invoke the callback on every
webservice call?
Thanks,
Dave