@PolicySets annotation of ws-security in JBossTools
aupres Sep 16, 2013 7:56 AMHello!
In jbossws-cxf-4.2.0.Final, @PolicySets annotation is provided for easy binding of WS-security and WSDL. For example,
===== SEI
@WebService(targetNamespace = "http://www.aaa.com/jbossws/ws-extensions/wssecurity")
@PolicySets({"WS-SP-EX223_WSS11_Anonymous_X509_Sign_Encrypt"}) // WS-Security binding is ok!
public interface IHelloWorld {
@WebMethod
@WebResult
public String sayHello(@WebParam String name);
}
===== Implementation Class
@WebService(
portName = "HelloWorldServicePort",
serviceName = "HelloWorldService",
targetNamespace = "http://www.aaa.com/jbossws/ws-extensions/wssecurity",
endpointInterface = "com.aaa.wss.IHelloWorld"
)
@EndpointConfig(configFile = "WEB-INF/jaxws-endpoint-config.xml", configName = "Custom WS-Security Endpoint") // This line is the problem!
public class HelloWorld implements IHelloWorld {
@Override
public String sayHello(String name) {
// TODO Auto-generated method stub
return "Hello " + name;
}
}
===== jaxws-endpoint-config.xml // This file is not built on Eclipse IDE
<jaxws-config xmlns="urn:jboss:jbossws-jaxws-config:4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="urn:jboss:jbossws-jaxws-config:4.0 schema/jbossws-jaxws-config_4_0.xsd">
<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>server</property-value>
</property>
....
WIth Eclipse IDE @PolicySets annotation in SEI works well. It binds WS-Security with WSDL.
But @EndpointConfig annotation in implementation class does not work at all. In Eclipse IDE @EndpointConfig can't import the jaxws-endpoint-config.xml configuration.
For more information, pls, check this issue,@EndpointConfig annotation not working.
The SoapUI has the user interface menu of WS-security endpoint configuration.( Pls see this site, http://www.soapui.org/SOAP-and-WSDL/applying-ws-security.html )
So, this is my suggestion to JBossTools team. I hope JBossTools would have user interface of WS-Security Endpoint Configuration like that of SoapUI.
That will help developers make ws-security codes more easily and conveniently.
If you think I am right, I hope the related JIRA to be made ASAP.
Best regrads!