CXF With UsernameToken (Interceptor)

Now we are using soapUI for testing CXF UsernameToken example

Create soapUI Project and add WSDL

New soapUI Project CXF With UsernameToken (Interceptor) soapUI

Run

On following screenshot, you can see the blue lines, which is specifying username as "joe", password as "joespassword" and WSS-Password Type as "PasswordText"

soapUI With UsernameToken

Run

You can also use wsimport tool for testing this service. Only thing need to change is modify the Main class according to below class

package com.client;

import java.util.Map;

import com.student.ChangeStudentDetails;
import com.student.ChangeStudentDetailsImplService;
import com.student.Student;
import javax.xml.ws.BindingProvider;
//CXF With UsernameToken (Interceptor)
public class Main {
 
public static void main(String[] args) {
   
ChangeStudentDetailsImplService service = new ChangeStudentDetailsImplService();
    ChangeStudentDetails changeStudentDetailsImplPort = service.getChangeStudentDetailsImplPort
();

    Map ctx =
((BindingProvider) changeStudentDetailsImplPort).getRequestContext();
    ctx.put
("ws-security.username", "joe");
    ctx.put
("ws-security.password", "joespassword");

    Student student =
new Student();
    student.setName
("Rockey");
    student = changeStudentDetailsImplPort.changeName
(student);
    System.out.println
(student.getName());

 
}

}
Output
Hello Rockey

 





Previous 1 2 3 4








4 Responses to "CXF With UsernameToken (Interceptor)"
  1. Kumar 2012-08-17 07:57:29.0
  1. admin 2012-08-18 07:57:29.0
  1. Sunil Gulabani 2012-08-19 07:57:29.0
  1. admin 2012-08-20 07:57:29.0

Your email address will not be published. Required fields are marked *