JAX-WS: Container level security on Weblogic
Aug 08, 10 by Juan Lebrijo about weblogic, Web Services, SoapUI, blog
In this post we are going to see how to secure a Web Service with basic HTTP Auth, in weblogic. We will base in a previous project where we created a very basic WS: Hello World. In the Security Realm > MyRealm we have to create:
  • An user: user/12345678
  • A group: TutorialUser
  • Add the user to the group
In the Weblogic console as we see on the picture:
manage_users_groups.thumbnail.png 11.4 KB
In web.xml we have to add the security confs needed (path, basic type,....):
   
    
        Regla01
        
            WSPOST
            
            /*
            POST
        
        
            
            TutorialUser
        
    
    
        5
    
    
        BASIC
        myrealm
    
    
        
        TutorialUser
    



In weblogic.xml map the application role with server role (it is mandatory):
    
        TutorialUser
        TutorialUser
    
We can test with SoapUI creating a new WS project, with WSDL address (http://localhost:7001/wsc/HelloService?WSDL) and previous Weblogic credentials created:
1007.thumbnail.gif 7.87 KB
JAX-WS: Serving Web Services SOAP
Aug 04, 10 by Juan Lebrijo about spring, weblogic, Web Services, blog, Eclipse
Today we will create a SOAP Web Service, based on LebrijoSchool project which we were making in early weeks over Oracle-Weblogic Architechture. First of all is to add the Web Services facet. Right button > Properties ... :
add_ws_facet.thumbnail.png 9.14 KB
After, we will create the class from a Spring Service class. Right button > New > WebLogic Web Service for Spring Beans:
expose_spring_as_ws.thumbnail.png 6.69 KB
Choose the Service, and the methods that we want to publish as Web Service. Finally put it in the logical package: lebrijo.school.webservices. And name it as "SchoolCertificatesWS". This is the code:
	@Autowired
	@Qualifier("RegistryService")
	private IRegistryService springServ;

	@WebMethod
	public Registry findRegistryById(java.lang.String id) throws Exception {
		return springServ.findRegistryById( id );
	}
We have a Weblogic client to test the WS, we can acces thru the URL http://localhost:7001/wls_utc/.
JAX-WS: Servir Web Services SOAP
Aug 04, 10 by Juan Lebrijo about spring, weblogic, Web Services, blog, Eclipse
Hoy crearemos un servicio web SOAP, basándonos en el proyecto LebrijoSchool que hemos venido haciendo sobre la arquitectura Oracle-Weblogic en artículos anteriores. Lo primero es añadir el facet de Web Services. Botón derecho > Properties ... :
add_ws_facet.thumbnail.png 9.14 KB
Después, creamos el WS a partir de una clase de servicio de Spring. Botón derecho > New > WebLogic Web Service for Spring Beans:
expose_spring_as_ws.thumbnail.png 6.69 KB
Elegimos el servicio, y los métodos que queremos publicar publicar como WS. Finalmente lo ponemos en el paquete adecuado: lebrijo.school.webservices. Y le damos un nombre "SchoolCertificatesWS". Nos queda un WS con este código:
	@Autowired
	@Qualifier("RegistryService")
	private IRegistryService springServ;

	@WebMethod
	public Registry findRegistryById(java.lang.String id) throws Exception {
		return springServ.findRegistryById( id );
	}
Para ver como funciona en WS tenemos un cliente en Weblogic, al que podemos acceder a través de la URL http://localhost:7001/wls_utc/.