Please find the example below.

server configuration file is as follows:

<?xml version="1.0" encoding="UTF-8"?>


<beans xmlns="http://www.springframework.org/schema/beans";
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
       xmlns:context="http://www.springframework.org/schema/context";
       xmlns:util="http://www.springframework.org/schema/util";       
       xmlns:jaxws="http://cxf.apache.org/jaxws";
       xmlns:jaxrs="http://cxf.apache.org/jaxrs";       
           xmlns:wsa="http://cxf.apache.org/ws/addressing";         
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
          http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd
          http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
          http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd";>


       
    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-policy.xml" />   
   
        <bean id="helloWorldService"
class="com.apachecxf.services.HelloWorldServiceBean" />

  <jaxws:endpoint id="helloWorld"
  implementor="#helloWorldService"
  address="/HelloWorld">       
               
  <jaxws:properties>
     
    <entry key="ws-security.ut.validator"
      value-ref="customUserTokenValidator" />
    </jaxws:properties>
   
    <jaxws:inInterceptors>
    <ref bean="loggingInInterceptor" />   
        <bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>
        </jaxws:inInterceptors>

        <jaxws:outInterceptors>               
                <ref bean="logOutInterceptor" />
        </jaxws:outInterceptors> 
                               
 </jaxws:endpoint> 

 
 
 <bean id="customUserTokenValidator"
class="com.apachecxf.services.CustomUserTokenValidator" />
 
 <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"
id="loggingInInterceptor" />
 <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"
id="logOutInterceptor" />   
 
</beans>

I have attached the wsdl along with this mail.

when I place a request from SOAP UI the following is created from the given
wsdl

HelloWorld.wsdl.xml

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:ser="http://services.apachecxf.com/";>
   <soapenv:header/>   
   <soapenv:Body>
      <ser:sayHello/>
   </soapenv:Body>
</soapenv:Envelope>

the service is not validated. The CustomUserTokenValidator class is not
called to validate service.

even if i add the necessary security header as follows

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:ser="http://services.apachecxf.com/";>
   <soapenv:header>
    <wsse:Security soapenv:mustunderstand="1"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";>
      <wsse:UsernameToken wsu:id="UsernameToken-27777511"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";>
      <wsse:Username>joe</wsse:Username>
      <wsse:Password
Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText";>Password</wsse:Password>
     </wsse:UsernameToken>
    </wsse:Security>
   </soapenv:header>   
   <soapenv:Body>
      <ser:sayHello/>
   </soapenv:Body>
</soapenv:Envelope>

still it is not validated.

Please provide advise.  HelloWorld.wsdl.xml
<http://cxf.547215.n5.nabble.com/file/n5729482/HelloWorld.wsdl.xml>  



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Ws-SecurityPolicy-not-working-using-SOAP-UI-tp5729482.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to