My Enviromnet:
--------------------
Application Server: JBOSS-AS7.1.1.Final JAVA: 1.7
Below is the Web Service code when I am sending request from Client it
doesn't check for security parameters mentioned in proprty file and returns
success call, i want interceptors to work as I dont
know spring i want to use wss4j api only, plz help.
Prop File:- (inside WEB-INF/classes)
org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=changeit123
org.apache.ws.security.crypto.merlin.keystore.file=publicstore.jks
org.apache.ws.security.crypto.merlin.keystore.alias=amit
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
// Client side Logging related CXF APIs
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
import org.apache.ws.security.WSConstants;
import org.apache.ws.security.handler.WSHandlerConstants;
import client.DemoCXF;
import client.DemoCXFService;
import client.Employee;
public class TestCXF
{
public static void main(String ar[]) throws Exception
{
String WSDL_URL="http://localhost:8080/cxfpoc?wsdl";
DemoCXFService service=new DemoCXFService(new URL(WSDL_URL));
DemoCXF port=service.getDemoCXFPort();
/* Following part of code is needed for client side Logging of Soap
request/response */
/* We need to make sure that we place the "log4j.properties" file
inside clients classpath */
Client client = ClientProxy.getClient(port);
client.getInInterceptors().add(new LoggingInInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());
Map<String,Object> outProps = new HashMap<String,Object>();
outProps.put(WSHandlerConstants.ACTION,
WSHandlerConstants.TIMESTAMP + " " +
WSHandlerConstants.SIGNATURE + " " +
WSHandlerConstants.ENCRYPT);
outProps.put(WSHandlerConstants.MUST_UNDERSTAND, "0");
outProps.put(WSHandlerConstants.ACTION, "Signature");
outProps.put(WSHandlerConstants.USER, "amit");
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,
KeystorePasswordCallback.class.getName());
outProps.put(WSHandlerConstants.SIG_PROP_FILE,
"client_sign.properties");
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
cxfEndpoint.getOutInterceptors().add(wssOut);
Employee emp=new Employee();
emp.setEmpNo(1000L);
emp.setEmpName("MiddlewaremagicEmployee");
emp.setEmpSalary(6000L);
System.out.println("\n\nBefore EmpNo: "+emp.getEmpNo()+",
Name:"+emp.getEmpName()+", Sal:"+emp.getEmpSalary());
emp=port.processEmployeeSalary(emp,1000L);
System.out.println("\n\nAfter EmpNo: "+emp.getEmpNo()+",
Name:"+emp.getEmpName()+", Sal:"+emp.getEmpSalary());
}
}
--
View this message in context:
http://cxf.547215.n5.nabble.com/CXF-WSS4J-Interceptors-tp5727229.html
Sent from the cxf-user mailing list archive at Nabble.com.