CSDN博客

img yuzhouhenan

wss4j实现wss

发表于2008/9/30 10:56:00  554人阅读

 关于这方面的资料很多,但是有一条就是你用的axis必须是axis2.我在axis1上实验没有成功。因为wss4j是最近两年出来的。而axis1就太早了,并且apache主推的是axis2
 客户端:
静态的:
EngineConfiguration config = new FileProvider("E://Factory//863//client_deploy.wsdd");
 Service   service   =   new   Service(config);

client_deploy.wsdd:

<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

 <transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender"/>

  <globalConfiguration >


 <handler type="java:org.apache.ws.axis.security.WSDoAllSender" >

  <parameter name="action" value="UsernameToken"/>

     <parameter name="user" value="wss4j"/>

     <parameter name="passwordCallbackClass" value="client.PWCallback"/>

     <parameter name="passwordType" value="PasswordText"/>
 </handler>

   </requestFlow >

  </globalConfiguration >

</deployment> 
  
动态的情况下client_deploy文件还是必须要的,但其中parameter不设定值。
   call.setProperty(UsernameToken.PASSWORD_TYPE,WSConstants.PASSWORD_TEXT);
    call.setProperty(WSHandlerConstants.USER, "wss4j");
    call.setProperty(WSHandlerConstants.PW_CALLBACK_CLASS, "client.PWCallback")

服务器端:

<service name="Hello" provider="java:RPC">
 <requestFlow>
  <handler type="soapmonitor"/>
 <handler type="java:org.apache.ws.axis.security.WSDoAllReceiver">
    <parameter name="passwordCallbackClass"
      value="server.PWCallback"/>
    <parameter name="action" value="UsernameToken"/>
   </handler>
 </requestFlow>

 <responseFlow>
<handler type="soapmonitor"/>
.........
</responseFlow>
 <parameter name="className" value="server.Hello"/>
 <parameter name="allowedMethods" value="*"/>
 <parameter name="scope" value="Request"/>-->
</service>
0 0

相关博文

我的热门文章

img
取 消
img