<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
missing <wsse:Security> tag in WS-Security
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/t.himaja">Himaja Thovi</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/580223#580223">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I made ejb module as web service. And i want to encrypt SOAP message based on WS-Security for that web service.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I followed Jboss in Action to configure WS-Security in Jboss server.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>At Server side:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Server.java</p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>import</b></font> javax.jws.WebService;
<font color="navy"><b>import</b></font> javax.ejb.Stateless;
<font color="navy"><b>import</b></font> org.jboss.ws.annotation.EndpointConfig;
 
@WebService()
@EndpointConfig(configName=<font color="red">"Standard WSSecurity Endpoint"</font>)
@Stateless()
<font color="navy"><b>public</b></font> <font color="navy"><b>class</b></font> Server <font color="navy">{</font>
    <font color="navy"><b>public</b></font> String message()<font color="navy">{</font>
        <font color="navy"><b>return</b></font> <font color="red">"hello"</font>;
    <font color="navy">}</font>
<font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I added jboss-wsse-server.xml, wsse.keystore, wsse.truststore in META-INF folder.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>jboss-wsse-server.xml</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag"><span><jboss-ws-security
xmlns="</span><a class="jive-link-external-small" href="http://www.jboss.com/ws-security/config" target="_blank">http://www.jboss.com/ws-security/config</a><span>"
xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"
xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://www.jboss.com/ws-security/config" target="_blank">http://www.jboss.com/ws-security/config</a><span>
</span><a class="jive-link-external-small" href="http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd" target="_blank">http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd</a><span>"></span></span>
<span class="jive-xml-tag"><key-store-file></span>META-INF/wsse.keystore<span class="jive-xml-tag"></key-store-file></span>
<span class="jive-xml-tag"><key-store-type></span>jks<span class="jive-xml-tag"></key-store-type></span>
<span class="jive-xml-tag"><key-store-password></span>wsseServer<span class="jive-xml-tag"></key-store-password></span>
<span class="jive-xml-tag"><trust-store-file></span>META-INF/wsse.truststore<span class="jive-xml-tag"></trust-store-file></span>
<span class="jive-xml-tag"><trust-store-type></span>jks<span class="jive-xml-tag"></trust-store-type></span>
<span class="jive-xml-tag"><trust-store-password></span>wsseServer<span class="jive-xml-tag"></trust-store-password></span>
<span class="jive-xml-tag"><config></span>
   <span class="jive-xml-tag"><encrypt type="x509v3" alias="wsseClient"/></span>
   <span class="jive-xml-tag"><requires></span>
    <span class="jive-xml-tag"><encryption /></span>
   <span class="jive-xml-tag"></requires></span>
<span class="jive-xml-tag"></config></span>
<span class="jive-xml-tag"></jboss-ws-security></span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>wsse.keystore</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code">Your keystore contains 2 entries
Alias name: wsseserver
Creation date: 5 Jan, 2011
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
Issuer: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
Serial number: 4d23ffdf
Valid from: Wed Jan 05 10:51:35 IST 2011 until: Tue Apr 05 10:51:35 IST 2011
Certificate fingerprints:
     MD5:  8D:6A:3E:C2:5C:B4:70:E1:18:E6:FB:97:4A:9B:74:A1
     SHA1: FE:7A:8A:EF:29:18:C4:42:75:E4:1E:18:C5:94:92:FE:D3:FC:41:3F
     Signature algorithm name: SHA1withRSA
     Version: 3
Alias name: wsseclient
Creation date: 5 Jan, 2011
Entry type: trustedCertEntry
Owner: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
Issuer: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
Serial number: 4d2403fc
Valid from: Wed Jan 05 11:09:08 IST 2011 until: Tue Apr 05 11:09:08 IST 2011
Certificate fingerprints:
     MD5:  82:09:26:68:DC:AE:FC:47:1E:C8:C5:A8:61:5A:EA:87
     SHA1: 0C:02:AE:FA:66:64:38:8F:39:6F:B9:C6:F4:E4:12:7F:AF:78:EF:EE
     Signature algorithm name: SHA1withRSA
     Version: 3
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>in wsse.truststore</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code">Your keystore contains 1 entry
Alias name: wsseserver
Creation date: 5 Jan, 2011
Entry type: trustedCertEntry
Owner: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
Issuer: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
Serial number: 4d23ffdf
Valid from: Wed Jan 05 10:51:35 IST 2011 until: Tue Apr 05 10:51:35 IST 2011
Certificate fingerprints:
     MD5:  8D:6A:3E:C2:5C:B4:70:E1:18:E6:FB:97:4A:9B:74:A1
     SHA1: FE:7A:8A:EF:29:18:C4:42:75:E4:1E:18:C5:94:92:FE:D3:FC:41:3F
     Signature algorithm name: SHA1withRSA
     Version: 3
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>i added jbossws-core.jar </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>At Client side:</p><p>My client is a stand-alone application and i didnot include any jars at this side</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-java"><font color="navy"><b>public</b></font> <font color="navy"><b>class</b></font> Main <font color="navy">{</font>
    <font color="navy"><b>public</b></font> <font color="navy"><b>static</b></font> <font color="navy"><b>void</b></font> main(String[] args) <font color="navy">{</font>
        <font color="navy"><b>try</b></font> <font color="navy">{</font> <font color="darkgreen">// Call Web Service Operation</font>
            com.ServerService service = <font color="navy"><b>new</b></font> com.ServerService();
            com.Server port = service.getServerPort();
            java.lang.String result = port.message();
            System.out.println(<font color="red">"Result = "</font>+result);
        <font color="navy">}</font> <font color="navy"><b>catch</b></font> (Exception ex) <font color="navy">{</font>
            ex.printStackTrace();
        <font color="navy">}</font>
    <font color="navy">}</font>
<font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>jboss-wsse-client.xml</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag"><span><jboss-ws-security
xmlns="</span><a class="jive-link-external-small" href="http://www.jboss.com/ws-security/config" target="_blank">http://www.jboss.com/ws-security/config</a><span>"
xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"
xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://www.jboss.com/ws-security/config" target="_blank">http://www.jboss.com/ws-security/config</a><span>
</span><a class="jive-link-external-small" href="http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd" target="_blank">http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd</a><span>"></span></span>
  <span class="jive-xml-tag"><key-store-file></span>
META-INF/wsseClient.keystore<span class="jive-xml-tag"></key-store-file></span>
  <span class="jive-xml-tag"><key-store-type></span>jks<span class="jive-xml-tag"></key-store-type></span>
  <span class="jive-xml-tag"><key-store-password></span>wsseClient<span class="jive-xml-tag"></key-store-password></span>
  <span class="jive-xml-tag"><trust-store-file></span>
  META-INF/wsseClient.truststore<span class="jive-xml-tag"></trust-store-file></span>
  <span class="jive-xml-tag"><trust-store-type></span>jks<span class="jive-xml-tag"></trust-store-type></span>
  <span class="jive-xml-tag"><trust-store-password></span>wsseClient<span class="jive-xml-tag"></trust-store-password></span>
  <span class="jive-xml-tag"><config></span>
   <span class="jive-xml-tag"><encrypt type="x509v3" alias="wsseServer"/></span>
   <span class="jive-xml-tag"><requires></span>
     <span class="jive-xml-tag"><encryption/></span>
   <span class="jive-xml-tag"></requires></span>
  <span class="jive-xml-tag"></config></span>
<span class="jive-xml-tag"></jboss-ws-security></span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>standard-jaxws-client-config.xml(copied this file from jboss server deployers/jbossws.deployer/META-INF/standard-jaxws-client-config.xml</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-xml"><span class="jive-xml-tag"><span><jaxws-config xmlns="urn:jboss:jaxws-config:2.0" xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>" xmlns:javaee="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a><span>"
  xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd"></span></span>
<span class="jive-xml-tag"><client-config></span>
    <span class="jive-xml-tag"><config-name></span>Standard WSSecurity Client<span class="jive-xml-tag"></config-name></span>
    <span class="jive-xml-tag"><post-handler-chains></span>
      <span class="jive-xml-tag"><javaee:handler-chain></span>
        <span class="jive-xml-tag"><javaee:protocol-bindings></span>##SOAP11_HTTP ##SOAP11_HTTP_MTOM<span class="jive-xml-tag"></javaee:protocol-bindings></span>
        <span class="jive-xml-tag"><javaee:handler></span>
          <span class="jive-xml-tag"><javaee:handler-name></span>WSSecurityHandlerOutbound<span class="jive-xml-tag"></javaee:handler-name></span>
          <span class="jive-xml-tag"><javaee:handler-class></span>org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient<span class="jive-xml-tag"></javaee:handler-class></span>
        <span class="jive-xml-tag"></javaee:handler></span>
      <span class="jive-xml-tag"></javaee:handler-chain></span>
    <span class="jive-xml-tag"></post-handler-chains></span>
  <span class="jive-xml-tag"></client-config></span>
<span class="jive-xml-tag"></jaxws-config></span>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>wsseClient.keystore</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code">Keystore type: JKS
Keystore provider: SUN
Your keystore contains 2 entries
Alias name: wsseserver
Creation date: 5 Jan, 2011
Entry type: trustedCertEntry
Owner: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
Issuer: CN=wsseServer, OU=esm, O=mq, L=hyd, ST=ap, C=in
Serial number: 4d23ffdf
Valid from: Wed Jan 05 10:51:35 IST 2011 until: Tue Apr 05 10:51:35 IST 2011
Certificate fingerprints:
     MD5:  8D:6A:3E:C2:5C:B4:70:E1:18:E6:FB:97:4A:9B:74:A1
     SHA1: FE:7A:8A:EF:29:18:C4:42:75:E4:1E:18:C5:94:92:FE:D3:FC:41:3F
     Signature algorithm name: SHA1withRSA
     Version: 3
Alias name: wsseclient
Creation date: 5 Jan, 2011
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
Issuer: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
Serial number: 4d2403fc
Valid from: Wed Jan 05 11:09:08 IST 2011 until: Tue Apr 05 11:09:08 IST 2011
Certificate fingerprints:
     MD5:  82:09:26:68:DC:AE:FC:47:1E:C8:C5:A8:61:5A:EA:87
     SHA1: 0C:02:AE:FA:66:64:38:8F:39:6F:B9:C6:F4:E4:12:7F:AF:78:EF:EE
     Signature algorithm name: SHA1withRSA
     Version: 3
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>wsseClient.truststore</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code">Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
Alias name: wsseclient
Creation date: 5 Jan, 2011
Entry type: trustedCertEntry
Owner: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
Issuer: CN=wsseClient, OU=esm, O=mq, L=hyd, ST=ap, C=in
Serial number: 4d2403fc
Valid from: Wed Jan 05 11:09:08 IST 2011 until: Tue Apr 05 11:09:08 IST 2011
Certificate fingerprints:
     MD5:  82:09:26:68:DC:AE:FC:47:1E:C8:C5:A8:61:5A:EA:87
     SHA1: 0C:02:AE:FA:66:64:38:8F:39:6F:B9:C6:F4:E4:12:7F:AF:78:EF:EE
     Signature algorithm name: SHA1withRSA
     Version: 3
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>i included all these configuration files in META-INF folder.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>but i am getting error as</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>at client-side</p><pre class="jive-pre"><code class="jive-code jive-java">javax.xml.ws.soap.SOAPFaultException: This service requires <wsse:Security>, which is missing.
        at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
        at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
        at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>at server-side</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><pre class="jive-pre"><code class="jive-code jive-java">Exception during handler processing
org.jboss.ws.core.CommonSOAPFaultException: This service requires <wsse:Security>, which is missing.
    at org.jboss.ws.extensions.security.WSSecurityDispatcher.convertToFault(WSSecurityDispatcher.java:264)
    at org.jboss.ws.extensions.security.WSSecurityDispatcher.decodeMessage(WSSecurityDispatcher.java:94)
    at org.jboss.ws.extensions.security.jaxws.WSSecurityHandler.handleInboundSecurity(WSSecurityHandler.java:81)
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>when i checked server.log, either incoming soap message or outgoing soap message not encrypted.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>please help me in solving out this issue.</p><p>I need to solve it as soon as possible.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Thanks in advance.</p></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/580223#580223">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>