客户端及服务端已经ok了,那么就看看运行效果吧
先运行服务端的main函数
Server server=new Server();
server.test(); //简单的不带usernametoken的WS
//server.testUserNameToken();// 启用usernametoken的WS
再启动客户端的main函数
WSClient client=new WSClient();
client.test();//测试PAYLOAD模式,不使用userNameToken身份验证机制
//client.testUserNameToken();//测试MESSAGE模式,使用userNameToken身份验证机制
客户端显示
http://service.test/">30jack's father.
再看看username token验证怎样
服务端运行:
Server server=new Server();
// server.test(); //简单的不带usernametoken的WS
server.testUserNameToken();// 启用usernametoken的WS
客户端运行:
WSClient client=new WSClient();
//client.test();//测试PAYLOAD模式,不使用userNameToken身份验证机制
client.testUserNameToken();//测试MESSAGE模式,使用userNameToken身份验证机制
运行结果:
http://schemas.xmlsoap.org/soap/envelope/">xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soap:mustUnderstand="1">http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-1">IamServerhttp://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">sssssxmlns:ns2="http://service.test/">30JACK's father.
补充一点:wsdl中的上面的arg0看着是不是不顺眼,还有一些参数名称是不是也看着不舒服?ok,那就继续学习cxf的。还记得Person类上面的@XmlRootElement(name="PersonName")吧,它就可以重命名,其它参数也是一样的机制,这就是java的jaxb了,继续学习吧