Cxf+spring+ws-security

0 respostas
novato25

Bom dia,

Estou desenvolvendo um web service com o Apache CXF utilizando Spring e WS-Security. Minha dúvida é em relação ao WS-Security. Fiz a configuração sugerida pela apache para uso de ws-security, mas não aparece nada em relação ao ws-security no WSDL. Agradeço a ajuda.

ApplicationContext.xml

<?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:cxf="http://cxf.apache.org/core"   
   xmlns:jaxws="http://cxf.apache.org/jaxws"  
   xmlns:jaxrs="http://cxf.apache.org/jaxrs" 
   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://cxf.apache.org/core  
        http://cxf.apache.org/schemas/core.xsd  
        http://cxf.apache.org/jaxws  
        http://cxf.apache.org/schemas/jaxws.xsd">  
  
   <!-- Carrega as configurações presentes nos jars do Apache CXF -->  
   <import resource="classpath:META-INF/cxf/cxf.xml" />  
   <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />  
   <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />  
   <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> 
    
     
   <!-- Endpoint WSDL para o Apache CXF -->  
   <!-- Dizemos o endereço, o ID do serviço, em qual bean ele depende -->  
   <jaxws:endpoint id="service" implementor="#serviceImpl" address="/service">
	   <jaxws:inInterceptors>
	     <bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
		     <constructor-arg>
                    <map>
                       <entry key="action" value="UsernameToken" />
            		   <entry key="passwordType" value="PasswordText" />
		               <entry key="passwordcallbackclass" value="endpoint.Calculadora"/>
                    </map>
                </constructor-arg>
            </bean>
	   </jaxws:inInterceptors>
   </jaxws:endpoint>  
   
      <!-- Bean que implementa o endpoint do nosso webservice -->  
   <bean id="serviceImpl" class="endpoint.Calculadora"/>  
</beans>

WSDL gerado

<?xml version="1.0" encoding="UTF-8" ?> 
- <wsdl:definitions name="CalculadoraService" targetNamespace="http://endpoint/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://endpoint/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <xs:schema elementFormDefault="unqualified" targetNamespace="http://endpoint/" version="1.0" xmlns:tns="http://endpoint/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="soma" type="tns:soma" /> 
  <xs:element name="somaResponse" type="tns:somaResponse" /> 
- <xs:complexType name="soma">
- <xs:sequence>
  <xs:element name="a" type="xs:int" /> 
  <xs:element name="b" type="xs:int" /> 
  </xs:sequence>
  </xs:complexType>
- <xs:complexType name="somaResponse">
- <xs:sequence>
  <xs:element name="return" type="xs:int" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:schema>
  </wsdl:types>
- <wsdl:message name="soma">
  <wsdl:part element="tns:soma" name="parameters" /> 
  </wsdl:message>
- <wsdl:message name="somaResponse">
  <wsdl:part element="tns:somaResponse" name="parameters" /> 
  </wsdl:message>
- <wsdl:portType name="Service">
- <wsdl:operation name="soma">
  <wsdl:input message="tns:soma" name="soma" /> 
  <wsdl:output message="tns:somaResponse" name="somaResponse" /> 
  </wsdl:operation>
  </wsdl:portType>
- <wsdl:binding name="CalculadoraServiceSoapBinding" type="tns:Service">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> 
- <wsdl:operation name="soma">
  <soap:operation soapAction="" style="document" /> 
- <wsdl:input name="soma">
  <soap:body use="literal" /> 
  </wsdl:input>
- <wsdl:output name="somaResponse">
  <soap:body use="literal" /> 
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="CalculadoraService">
- <wsdl:port binding="tns:CalculadoraServiceSoapBinding" name="CalculadoraPort">
  <soap:address location="http://localhost:8080/calculadora-ws/service" /> 
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>
Criado 23 de março de 2011
Respostas 0
Participantes 1