Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » WS-Security problem with eclipse ide
WS-Security problem with eclipse ide [message #1106368] Tue, 10 September 2013 22:33
Joseph Hwang is currently offline Joseph Hwang
Messages: 4
Registered: September 2013
Junior Member
I am struggling with jbossws-cxf-4.2.0.Final ws-security implementation with eclipse ide.
This is my service endpoint interface and service class code.

===== IHelloWorld Interface
@WebService(targetNamespace="http:/www.aaa.com/jbossws/ws-extensions/wssecurity" )
@PolicySets({"WS-Addressing","WS-SP-EX223_WSS11_Anonymous_X509_Sign_Encrypt"})
public interface IHelloWorld {

@WebMethod
@WebResult
public String sayHello(@WebParam String name);

}

=====HelloWorld.java
@WebService(
portName = "HelloWorldServicePort",
serviceName = "HelloWorldService",
targetNamespace = "http:/www.aaa.com/jbossws/ws-extensions/wssecurity",
endpointInterface = "com.aaa.ws.IHelloWorld"
)
@EndpointConfig(configFile = "WEB-INF/jaxws-endpoint-config.xml", configName = "Custom WS-Security Endpoint") // this line DOES NOT WORK!!!
public class HelloWorld implements IHelloWorld {
@Override
public String sayHello(String name) {
// TODO Auto-generated method stub
return "Hello " + name;
}
}

====== jaxws-endpoint-config.xml
<endpoint-config>
<config-name>Custom WS-Security Endpoint</config-name>
<property>
<property-name>ws-security.signature.properties</property-name>
<property-value>META-INF/server.properties</property-value>
</property>
<property>
<property-name>ws-security.encryption.properties</property-name>
<property-value>META-INF/server.properties</property-value>
</property>
<property>
<property-name>ws-security.signature.username</property-name>
<property-value>client</property-value>
</property>
<property>
<property-name>ws-security.encryption.username</property-name>
<property-value>server</property-value>

====== client
public class WSSClient {

private final String serviceURL="http:/localhost:8080/WSSHelloWorld/HelloWorld";
private IHelloWorld proxy;

public WSSClient() throws IOException {
QName serviceName = new QName("http:/www.aaa.com/jbossws/ws-extensions/wssecurity", "HelloWorldService");
URL wsdlURL = new URL(serviceURL + "?wsdl");
Service service = Service.create(wsdlURL, serviceName);
proxy = (IHelloWorld)service.getPort(IHelloWorld.class);

((BindingProvider)proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/client.properties"));
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/client.properties"));
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "client");
((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "server");

} // the constructor throws no exception.
public String callMethd(String name) {
return proxy.sayHello(name); // this method throws exception
I try to jbossws-cxf ws-security in eclipse ide.But there is no document or reference site.
Pls, check this issue, https:/community.jboss.org/thread/232031
Your advice will be appreciated! Thanks in advance

[Updated on: Tue, 10 September 2013 22:34]

Report message to a moderator

Previous Topic:http status 404 - the requested resource is not available
Next Topic:What should soap url be to intercept soap message with eclipse tcp/ip monitor?
Goto Forum:
  


Current Time: Mon Jul 28 12:47:04 EDT 2014

Powered by FUDForum. Page generated in 0.01755 seconds