Hi, I have developed an Java-First JAX-WS Webservice with spring-ws. Now i want to secure the Webservice with methode security. Does anyone know an good example how to secure a webservice like that.
My Project looks similar like the following example:
SEI:
Implemantation:Code:package de.example; import javax.jws.WebMethod; import javax.jws.WebService; /** * The Interface Multiplicator. */ @WebService public interface Multiplicator { /** * Multiplicate. * * @param op1 the op1 * @param op2 the op2 * @return the double */ @WebMethod public double multiplicate(double op1, double op2); }
web.xmlCode:package de.example; import javax.jws.WebService; /** * The Class MultiplicatorImpl. */ @WebService(serviceName = "MultiplicatorService", endpointInterface="de.example.Multiplicator") public class MultiplicatorImpl implements Multiplicator { /* (non-Javadoc) * @see de.example.Multiplicator#multiplicate(double, double) */ public double multiplicate(double op1, double op2) { return op1 * op2; } }
spring-ws-servlet.xmlCode:<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>Archetype Created Web Application</display-name> <servlet> <servlet-name>spring-ws</servlet-name> <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>spring-ws</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
How can I secure this via method security provided by spring.Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter"> <property name="baseAddress" value="http://localhost:9999/"/> </bean> <bean id="multiplicatorServiceEndpoint" class="de.example.MultiplicatorImpl" /> </beans>
Thanks for any help.
Oliver


Reply With Quote