An error was discovered processing the header.

An error was discovered processing the <wsse:Security> header.
http://blog.sina.com.cn/s/blog_77a2a8b301015fls.html
  	Map<String, Object> outProps = new HashMap<String, Object>(); 
	        outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN); 
	        outProps.put(WSHandlerConstants.USER, "admin"); 
	        outProps.put(WSHandlerConstants.PASSWORD_TYPE, "admin"); 
	        outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,  UsernamePasswordCallbackClient.class.getName()); 
	        ArrayList list = new ArrayList(); 
	        // 添加cxf安全验证拦截器,必须 
	        list.add(new SAAJOutInterceptor()); 
	        list.add(new WSS4JOutInterceptor(outProps)); 
	        
		
		  //创建WebService客户端代理工厂
		  JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		  //注册WebService接口
		  factory.setServiceClass(CmsWebService.class);
		  //设置WebService地址
		  factory.setAddress("http://localhost:8080/as/ws/cmsWebService");
		  CmsWebService cmsWebService = (CmsWebService)factory.create();
		  
		  factory.getOutInterceptors().addAll(list); 
			
		  System.out.println("invoke webservice...");
		  StringBuffer sb = new StringBuffer();
		  sb.append("{\"id\":");
			sb.append("\"111\"");
			sb.append(", \"placardId\":");
			sb.append(2956729);
			sb.append(",  \"placardTitle\":");
			sb.append("\"太仆寺旗城镇管理局清洁卫生车辆公开招标招标公告\"");
			sb.append("}");
		  System.out.println("message context is:"+cmsWebService.inputArticle("1", "aa","bb",sb.toString()));  

你可能感兴趣的:(Security)