I'm using WSS4j Interceptors for WS-Security UsernameToken authentication
with ACEGI (for CXF) and that works great. But I'm also using jax-ws
annotations to define my webservice and I want to access the Username token
as a webservice method arg as well. My webservice interface looks something
like this:
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.ws.security.message.token.UsernameToken;
@WebService
public interface MyService {
public String myMethod(
@WebParam(name = WSHandlerConstants.USERNAME_TOKEN,
header =
true)UsernameToken usernameToken, String myString);
}
Obviously I have an implementation class as well where I grab the username &
password (that was already authenticated via WSS4jInterceptor) to use later.
But I'm trying to just get the WSDL for the service and when CXF tries to
generate the WSDL it gives and exception. It looks like its trying to
create a WSDL entry for the UsernameToken arg, but my assumption is that
when you mark "header=true" that would not happen and at "runtime" when the
WS is called it just sets it. CXF Exception when I try get the WSDL:
WARNING: org.apache.cxf.transport.http.WSDLQueryHandler Exception caught
writing response.
org.apache.cxf.transport.http.WSDLQueryException: Exception occurred while
trying to process <MyWSDLUrl>
at
org.apache.cxf.transport.http.WSDLQueryHandler.writeResponse(WSDLQueryHandler.java:214)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:152)...
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR:
Can't find prefix for 'http://token.message.security.ws.apache.org'.
Namespace prefixes must be set on the Definition object using the
addNamespace(...) method.
at com.ibm.wsdl.util.xml.DOMUtils.getPrefix(Unknown Source)
at com.ibm.wsdl.util.xml.DOMUtils.getQualifiedValue(Unknown
Source)...
--
View this message in context:
http://www.nabble.com/Trying-to-get-CXF-reading-UsernmeToken-as-jax-ws-webparam-annotation--tp19920054p19920054.html
Sent from the cxf-user mailing list archive at Nabble.com.