Forum Discussion

Anonymous's avatar
Anonymous
8 years ago

How to bind jbossws properties files to soap request and response message in soapui?

As you know, in wildfly ws-security configuration, 2 properties files are binded to web service. In server side server.properties is binded like below,

== server.properties

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=password123
org.apache.ws.security.crypto.merlin.keystore.alias=servicekey
org.apache.ws.security.crypto.merlin.keystore.file=META-INF/serviceKeystore.jks

== 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.callback-handler</property-name>       
      <property-value>
      com.aaa.soap.KeystorePasswordCallback
      </property-value>        
   </property>   
   </endpoint-config>

== HelloWorld.java

 

@WebService
@EndpointConfig(configFile = "WEB-INF/jaxws-endpoint-config.xml", configName = "Custom WS-Security Endpoint")
public class HelloWorld implements IHelloWorld {
    @Override
    public String sayHello(String name) {
        // TODO Auto-generated method stub
        return "Hello " + name;
    }
}

In client side, JSP files are binding client.properties to soap request.

== client.properties

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=password123
org.apache.ws.security.crypto.merlin.keystore.alias=servicekey
org.apache.ws.security.crypto.merlin.keystore.file=META-INF/serviceKeystore.jks

== index.jsp

 

<body>
<% 
String SERVICE_URL = "http://localhost:8080/SOAPEncryptWeb/HelloWorld";

try {
    QName serviceName = new QName("http://soap.aaa.com/", "HelloWorldService");

    URL wsdlURL;
    wsdlURL = new URL(SERVICE_URL + "?wsdl");
    Service service = Service.create(wsdlURL, serviceName);

    IHelloWorld port = (IHelloWorld) service.getPort(IHelloWorld.class); 

    ((BindingProvider) port).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());
    ((BindingProvider) port).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES, Thread.currentThread().getContextClassLoader().getResource("META-INF/client.properties"));
    ((BindingProvider) port).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "servicekey");
    out.println(port.sayHello("jina"));
} catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
%>
</body>

So in soapui application I remake these client/server properties like below,

 

 

But I am stuck on this part. These server and client properties are binded successfully on eclipse ide. However in soapui application i have no idea how to bind these properties with soap request and response. I need any tutorials. Your helping response will be deeply appreciated. Best regards.

No Replies