Showing posts with label Mule ESB. Show all posts
Showing posts with label Mule ESB. Show all posts

Tuesday, March 25, 2014

Create Proxy Service for secure web service call using Mule ESB

Mule is open source Enterprise Service Bus. You can create proxy service of a web-service easily with mule. You can transform request and response payload using Mule XSLT transformation.

Following figure is showing diagram of Mule proxy service and XSLT transformation.



Below is configuration XML.

 
  
   
  
  
   
  

 

 
  
  


  
  

  

  

   
    
     
     
     
     
     
    
   
   
    
   
   
    
   
  

  


  



  
   
    
     

    
   
   
    
     
    
   
  

 

To set password following code snippet is used for password callback
package lr.mule.security;

import java.io.IOException;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

import org.apache.ws.security.WSPasswordCallback;

public class PasswordCallback implements CallbackHandler
{
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
    {
        WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];

       
         
            pc.setPassword("password");
       
       
    }
}