我實現了通過WS-Security的認證上我的web服務,像這樣:春天的WS-Security可見於<a href="http://static.springframework.org/spring-ws/sites/1.5/reference/html/security.html" rel="nofollow noreferrer">http://static.springframework.org/spring-ws/sites/1.5/reference/html/security.html</a>描述WSDL
<bean id="callbackHandler" class="org.springframework.ws.soap.security.wss4j.callback.SimplePasswordValidationCallbackHandler">
<property name="users">
<props>
<prop key="bart">arnie</prop>
</props>
</property>
</bean>
<bean id="annotationMapping" class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
<property name="interceptors">
<list>
<bean class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor">
<property name="validationActions" value="UsernameToken" />
<property name="securementActions" value="NoSecurity" />
<property name="validationCallbackHandler" ref="callbackHandler" />
</bean> ...
但是,客戶端(如了SoapUI)不知道他們應該使用安全性,因爲它在WSDL中沒有提及。我怎樣才能得到它?這是我如何產生的呢:
<bean id="qwertyService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
<property name="schemaCollection" ref="schemaCollection" />
<property name="portTypeName" value="QwertyService" />
<property name="locationUri" value="/QwertyService/" />
<property name="targetNamespace" value="http://www.ead2.nl/demo/wsdl" />
</bean>
顯然我誤解了WS-Security和它不可能在WSDL中註明。儘管如此,請隨時反駁。 – 2009-06-25 12:17:57