On Wednesday, December 14, 2011 9:04:53 PM manoj_cxf wrote:
> Hi,
> 
> I am getting the following error while using CXF Client to consume web
> service.
> 
> javax.xml.ws.soap.SOAPFaultException: The security context token is expired
> or is not valid. The message was not processed.

This message LIKELY means that the server is expecting some sort of WS-
Security credentials.   Nothing in your code below is setting anything up for 
that.    Does the server provide a WSDL with some WS-SecurityPolicy 
definitions in it?  If so, you would likely need to pass that into the 
factory.setWsdlLocation so the policies can be picked up and applied.  You'd 
also need to set whatever security keys are needed for the policy.  See:

http://cxf.apache.org/docs/ws-securitypolicy.html

Dan



>       at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
>       at $Proxy38.getUserPoints(Unknown Source)
>       at com.cxf.auth.client.SOCCXFClient.main(SOCCXFClient.java:68)
> 
> Below is my Client Code:
> 
>                       JaxWsProxyFactoryBean factory = new 
> JaxWsProxyFactoryBean();
> 
>                       factory.getInInterceptors().add(new 
> LoggingInInterceptor());
>                       factory.getOutInterceptors().add(new 
> LoggingOutInterceptor());
>                       factory.setServiceClass(IShuiOnService.class);
> 
> factory.setAddress("http://192.168.2.74:8080/webtools/control/SOAPService";);
> 
>                       factory.setUsername("test");
>                       factory.setPassword("test");
> 
>                       
factory.setBindingId("http://schemas.xmlsoap.org/wsdl/soap12/";);
>                       IShuiOnService client = (IShuiOnService) 
> factory.create();
> 
>                       Client cl = ClientProxy.getClient(client);
>                       HTTPConduit httpConduit = (HTTPConduit) cl.getConduit();
>                       HTTPClientPolicy httpClientPolicy = new 
> HTTPClientPolicy();
>                       httpClientPolicy.setContentType("application/soap+xml; 
charset=utf-8");
>                       httpClientPolicy.setAllowChunking(false);
>                       httpConduit.setClient(httpClientPolicy);
> 
>                       String message = client.getUserPoints("");
>                       System.out.println("Server said: " + message);
> 
> Can someone help me on this please.
> 
> Thanks,
> Manoj
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/The-security-context-token-is-expired-or-is
> -not-valid-ERROR-tp5076527p5076527.html Sent from the cxf-user mailing list
> archive at Nabble.com.
-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to