|
Hi all
This might be quite a basic question or I might
have a complete misunderstanding of the mechanism so I hope someone can help
either way.
I have a webservice client which can be configured
on the fly to invoke any webservice. At the moment I'm trying to run
against a webservice that uses custom tokens for authenticating incoming
messages. Their token is returned to my code from an earlier operation
call as a block of xml, and the has to be included with all subsequent operation
calls. I know (or at least, I think) that to add username tokens to
operation calls I can hook in the WSDoAllSender and WSDoAllReceiver to my Axis
Call object and set various properties such as Action="" User=
etc. Is there anyway of adding this custom token, which I have in the code
as a string of xml, to out-going operation calls in the same way, using the
handlers and properties on the Call obejct?
Or, in fact, is there any way at all of using this
custom token with WSS4J and Axis, even if it means a new approach in my
code? The basic structure of my code is as follows:
ServiceFactory serviceFactory =
ServiceFactory.newInstance();
webService = serviceFactory.createService(wsdlUrl, serviceQName); ...
Call opCall = webService.createCall(portQName,
operationName);
...
// Safely cast from a javax.xml.rpc.Call object to
a org.apache.axis.client.Call
// object so that we can hook in security handlers
and add headers
org.apache.axis.client.Call axisCall = null; axisCall = new org.apache.axis.client.Call("http://www.dummyurl.com"); if(opCall.getClass().isInstance(axisCall)) axisCall = (org.apache.axis.client.Call)opCall; else axisCall = null; if(axisCall != null) { // Add security handlers if required if(reqHandler != null && respHandler != null) axisCall.setClientHandlers(reqHandler, respHandler); } ...
// Set properties on the call, if any have been
requested to be set
if(!properties.isEmpty()) { Iterator it = properties.keySet().iterator(); while(it.hasNext()) { String next = (String)it.next(); axisCall.setProperty(next, properties.get(next)); } } ...
return axisCall.invoke(parameters);
Any help would be greatly appreciated.
Chris Mannion IT Junction 020 8452 4274 |
