I'm trying to get WS-Security following the sample that comes with xfire
and
http://arsenalist.com/2007/01/18/implementing-ws-security-with-jsr181-an
notations-using-wss4j-in-xfire/#comments
When I add WSS4JOutHandler to the client I'm getting a NamespaceURI
cannot be null expection. What Namespace is the expection referring to?
. . .
Service serviceModel = new
ObjectServiceFactory().create(VehicleLookupService.class,"VehicleLookupS
ervice", SERVICE_NAMESPACE, null);
VehicleLookupService service = (VehicleLookupService) new
XFireProxyFactory().create(serviceModel,_serviceUrl);
Client client = ((XFireProxy)
Proxy.getInvocationHandler(service)).getClient();
client.addOutHandler(new DOMOutHandler());
Properties properties = new Properties();
configureOutProperties(properties);
client.addOutHandler(new WSS4JOutHandler(properties));
LookupVehiclesRequest lookupRequest =
RequestBuilder.buildLookupVehiclesRequest(cmd);
LookupVehiclesResponse r =
service.getVehicles(lookupRequest);
. . .
private void configureOutProperties(Properties properties) {
// Action to perform : user token
properties.setProperty(WSHandlerConstants.ACTION,
WSHandlerConstants.USERNAME_TOKEN);
// Set password type to hashed
properties.setProperty(WSHandlerConstants.PASSWORD_TYPE,
WSConstants.PW_DIGEST);
// Username in keystore
properties.setProperty(WSHandlerConstants.USER, "root");
// Used do retrive password for given user name
properties.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS,
PasswordHandler.class.getName());
}
2007-01-19 09:44:55,842 ERROR
[org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/oracle]
.[spring]] - Servlet.service() for servlet spring threw exception
org.codehaus.xfire.XFireRuntimeException: Could not invoke service..
Nested exception is org.codehaus.xfire.fault.XFireFault: NamespaceURI
cannot be null
org.codehaus.xfire.fault.XFireFault: NamespaceURI cannot be null
at
org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
at
org.codehaus.xfire.util.dom.DOMSerializer.writeMessage(DOMSerializer.jav
a:47)
at
org.codehaus.xfire.transport.http.HttpChannel.writeWithoutAttachments(Ht
tpChannel.java:56)
at
org.codehaus.xfire.transport.http.CommonsHttpMessageSender.getByteArrayR
equestEntity(CommonsHttpMessageSender.java:388)
at
org.codehaus.xfire.transport.http.CommonsHttpMessageSender.send(CommonsH
ttpMessageSender.java:326)
at
org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.
java:123)
at
org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java
:26)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:1
31)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
at org.codehaus.xfire.client.Client.invoke(Client.java:335)
at
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy11.getVehicles(Unknown Source)
at
com.autoreturn.service.VehicleLookupServiceController.handle(VehicleLook
upServiceController.java:72)
at
org.springframework.web.servlet.mvc.AbstractCommandController.handleRequ
estInternal(AbstractCommandController.java:82)
at
org.springframework.web.servlet.mvc.AbstractController.handleRequest(Abs
tractController.java:153)
at
org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handl
e(SimpleControllerHandlerAdapter.java:45)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherS
ervlet.java:806)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherSe
rvlet.java:736)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(Framewor
kServlet.java:396)
at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.
java:350)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
48)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86
9)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:664)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollow
erWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.xml.stream.XMLStreamException: NamespaceURI cannot be
null
at
com.sun.xml.stream.writers.XMLStreamWriterImpl.writeAttribute(XMLStreamW
riterImpl.java:324)
at
org.codehaus.xfire.util.STAXUtils.writeElement(STAXUtils.java:366)
at org.codehaus.xfire.util.STAXUtils.writeNode(STAXUtils.java:391)
at
org.codehaus.xfire.util.STAXUtils.writeElement(STAXUtils.java:380)
at org.codehaus.xfire.util.STAXUtils.writeNode(STAXUtils.java:391)
at
org.codehaus.xfire.util.STAXUtils.writeElement(STAXUtils.java:380)
at org.codehaus.xfire.util.STAXUtils.writeNode(STAXUtils.java:391)
at
org.codehaus.xfire.util.STAXUtils.writeElement(STAXUtils.java:380)
at org.codehaus.xfire.util.STAXUtils.writeNode(STAXUtils.java:391)
at
org.codehaus.xfire.util.STAXUtils.writeElement(STAXUtils.java:380)
at
org.codehaus.xfire.util.STAXUtils.writeDocument(STAXUtils.java:285)
at
org.codehaus.xfire.util.dom.DOMSerializer.writeMessage(DOMSerializer.jav
a:40)
... 36 more
Thanks,,, deno