Hi Dan,
As the objective is to get this example working, I switched back to my
client code(static client generation) instead of using the
JaxWsDynamicClientFactory.
Appreciate your help,
Vivek.
Here is the current Client
code:---------------------------------------------------------
public static void main(String args[]) throws Exception {
URL wsdlURL = new
URL("http://localhost:9085/CXFExample3/cxf-library?wsdl");
QName SERVICE_NAME = new QName("http://ws.sosnoski.com/library/wsdl",
"CXFLibrary");
Service service = Service.create(wsdlURL, SERVICE_NAME);
System.out.println("Service ================== ");
Library port = service.getPort(Library.class);
Map<String, Object> ctx = ((BindingProvider)port).getRequestContext();
ctx.put("ws-security.username", "vivek");
ctx.put("ws-security.callback-handler",
ClientPasswordCallback.class.getName());
ctx.put("ws-security.password", "vivek"); // another option for
passwords
BookInformation inf = port.getBook("Vivek");
System.out.println("Result = " + inf.getTitle());
}
Now, I am getting below
exception:------------------------------------------------------------
Nov 3, 2010 2:30:12 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {http://ws.sosnoski.com/library/wsdl}CXFLibrary from
WSDL: http://localhost:9085/CXFExample3/cxf-library?wsdl
Nov 3, 2010 2:30:12 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {http://ws.sosnoski.com/library/wsdl}CXFLibrary from
WSDL: http://localhost:9085/CXFExample3/cxf-library?wsdl
Exception in thread "main" javax.xml.ws.WebServiceException:
java.lang.RuntimeException: Incorrect inclusion value: null
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:144)
at $Proxy29.getBook(Unknown Source)
at
com.svl.myexample.outbound.Library_Library_Client.main(Library_Library_Client.java:85)
Caused by: java.lang.RuntimeException: Incorrect inclusion value: null
at
org.apache.cxf.ws.security.policy.model.Token.setInclusion(Token.java:63)
at
org.apache.cxf.ws.security.policy.builders.UsernameTokenBuilder.build(UsernameTokenBuilder.java:59)
at
org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.build(AssertionBuilderRegistryImpl.java:142)
at
org.apache.cxf.ws.policy.PolicyBuilderImpl.processOperationElement(PolicyBuilderImpl.java:192)
at
org.apache.cxf.ws.policy.PolicyBuilderImpl.getPolicyOperator(PolicyBuilderImpl.java:135)
at
org.apache.cxf.ws.policy.PolicyBuilderImpl.getPolicy(PolicyBuilderImpl.java:131)
at
org.apache.cxf.ws.security.policy.builders.SupportingTokens12Builder.build(SupportingTokens12Builder.java:96)
at
org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl.build(AssertionBuilderRegistryImpl.java:142)
at
org.apache.cxf.ws.policy.PolicyBuilderImpl.processOperationElement(PolicyBuilderImpl.java:192)
at
org.apache.cxf.ws.policy.PolicyBuilderImpl.getAllOperator(PolicyBuilderImpl.java:143)
at
org.apache.cxf.ws.policy.PolicyBuilderImpl.processOperationElement(PolicyBuilderImpl.java:186)
at
org.apache.cxf.ws.policy.PolicyBuilderImpl.getExactlyOneOperator(PolicyBuilderImpl.java:139)
at
org.apache.cxf.ws.policy.PolicyBuilderImpl.processOperationElement(PolicyBuilderImpl.java:188)
at
org.apache.cxf.ws.policy.PolicyBuilderImpl.getPolicyOperator(PolicyBuilderImpl.java:135)
at
org.apache.cxf.ws.policy.PolicyBuilderImpl.getPolicy(PolicyBuilderImpl.java:131)
at
org.apache.cxf.ws.policy.attachment.reference.LocalServiceModelReferenceResolver.resolveReference(LocalServiceModelReferenceResolver.java:52)
at
org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.resolveLocal(Wsdl11AttachmentPolicyProvider.java:246)
at
org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.resolveReference(Wsdl11AttachmentPolicyProvider.java:232)
at
org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:184)
at
org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:165)
at
org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getElementPolicy(Wsdl11AttachmentPolicyProvider.java:158)
at
org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider.getEffectivePolicy(Wsdl11AttachmentPolicyProvider.java:95)
at
org.apache.cxf.ws.policy.PolicyEngineImpl.getAggregatedEndpointPolicy(PolicyEngineImpl.java:371)
at
org.apache.cxf.ws.policy.EndpointPolicyImpl.initializePolicy(EndpointPolicyImpl.java:151)
at
org.apache.cxf.ws.policy.EndpointPolicyImpl.initialize(EndpointPolicyImpl.java:140)
at
org.apache.cxf.ws.policy.PolicyEngineImpl.createEndpointPolicyInfo(PolicyEngineImpl.java:504)
at
org.apache.cxf.ws.policy.PolicyEngineImpl.getEndpointPolicy(PolicyEngineImpl.java:255)
at
org.apache.cxf.ws.policy.PolicyEngineImpl.getClientEndpointPolicy(PolicyEngineImpl.java:237)
at
org.apache.cxf.transport.http.policy.PolicyUtils.getClient(PolicyUtils.java:150)
at
org.apache.cxf.transport.http.HTTPConduit.initializeConfig(HTTPConduit.java:331)
at
org.apache.cxf.transport.http.HTTPConduit.<init>(HTTPConduit.java:299)
at
org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory.getConduit(ClientOnlyHTTPTransportFactory.java:63)
at
org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory.getConduit(ClientOnlyHTTPTransportFactory.java:50)
at
org.apache.cxf.binding.soap.SoapTransportFactory.getConduit(SoapTransportFactory.java:214)
at
org.apache.cxf.endpoint.AbstractConduitSelector.getSelectedConduit(AbstractConduitSelector.java:78)
at
org.apache.cxf.endpoint.UpfrontConduitSelector.prepare(UpfrontConduitSelector.java:61)
at
org.apache.cxf.endpoint.ClientImpl.prepareConduitSelector(ClientImpl.java:778)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:510)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
... 2 more
--
View this message in context:
http://cxf.547215.n5.nabble.com/WS-Security-UsernameToken-in-IBM-WAS-7-0-IBM-jdk-1-6-tp3248527p3248968.html
Sent from the cxf-user mailing list archive at Nabble.com.