<!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">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;">
    building a WS Client with WS-Security
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/jplistero">juan pablo</a> in <i>JBoss Web Services</i> - <a href="http://community.jboss.org/message/548245#548245">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 all, </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I' am trying to build a web service client and sing the soap message. </p><p>I 'am using jbossws-cxf to generate the Stubs with wsconsume tool. </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My first problem is to build the jboss-wsse-client.xml ... </p><p>I have my private key, my sing cert and the CA root for the server (I havent access to the server)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>to build a keystore I use:</p><p>openssl pkcs12 -export -chain -in mySing.crt -CAfile root.cer -inkey myPrivate.key -out keystore.pkcs12</p><p>(I made a client with a soapui tool, and the keystore works fine)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>so ... my&#160; jboss-wsse-client.xml: </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><div id="_mcePaste"><strong><span>&lt;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>"</span></strong></div><div id="_mcePaste"><strong><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>"</span></strong></div><div id="_mcePaste"><strong><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></strong></div><div id="_mcePaste"><strong><span>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </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>"&gt;</span></strong></div><div id="_mcePaste"><strong>&lt;config&gt;</strong></div><div id="_mcePaste"><strong>&lt;sign type="x509v3" alias="1" /&gt;</strong></div><div id="_mcePaste"><strong>&lt;requires&gt;</strong></div><div id="_mcePaste"><strong>&lt;signature /&gt;</strong></div><div id="_mcePaste"><strong>&lt;/requires&gt;</strong></div><div id="_mcePaste"><strong>&lt;/config&gt;</strong></div><div id="_mcePaste"><strong>&lt;/jboss-ws-security&gt;</strong></div><div> </div><div>And in my Client, this is my code:</div><div> </div><div><strong> System.setProperty("org.jboss.ws.wsse.keyStore","/home/jp/tmp/keystore.pkcs12");</strong></div><div><span><strong> </strong></span><strong> System.setProperty("org.jboss.ws.wsse.keyStorePassword", "12345");</strong></div><div><strong> System.setProperty("org.jboss.ws.wsse.keyStoreType", "pkcs"); </strong></div><div> </div><div><strong><div>SomeService service = new SomeService();<span> </span></div><div><span> </span>SomePort port =&#160; service.getPort();</div><div> </div><div><div>URL securityURL = new File("/home/jp/workspace1/myProject/src/META-INF/jboss-wsse-client.xml").toURL();</div><div><span> </span>((StubExt) port).setSecurityConfig(securityURL.toExternalForm());</div><div><span> </span>((StubExt) port).setConfigName("Standard WSSecurity Client","/home/jp/workspace1<span style="font-weight: normal;"><strong><div style="display: inline !important;"><div style="display: inline !important;"><strong><div style="display: inline !important;"><div style="display: inline !important;"><strong><div style="display: inline !important;"><div style="display: inline !important;"><strong><div style="display: inline !important;"><div style="display: inline !important;">/myProject<span style="font-weight: normal;"><strong><div style="display: inline !important;"><div style="display: inline !important;">/src/META-INF/jboss-wsse-client.xml");</div><div style="display: inline !important;"> </div><div style="display: inline !important;"> </div><div style="display: inline !important;"><span style="font-weight: normal;">also I add reference to jboss-AS-5.1/lib/endoresed and jboss-AS-5.1/client</span></div><div style="display: inline !important;"><span style="font-weight: normal;"><br/></span></div><div style="display: inline !important;"><span style="font-weight: normal;"> </span></div><div style="display: inline !important;"><span style="font-weight: normal;"> </span></div><div style="display: inline !important;"> </div><div style="display: inline !important;"><span style="font-weight: normal;">Someone known what is Wrong ? the jboss-wsse-client.xml ? the Client ? the references jars ?</span></div><div style="display: inline !important;"><span style="font-weight: normal;"><br/></span></div><div style="display: inline !important;"><span style="font-weight: normal;"><br/></span></div><div style="display: inline !important;"><span style="font-weight: normal;">now I'am having this exception</span></div><div style="display: inline !important;"><span style="font-weight: normal;"><strong><div><div><span><strong><div><div><strong><div><div><strong><div><div><strong><div><div><span><strong><div><div><span><div>java.lang.reflect.UndeclaredThrowableException</div></span></div></div></strong></span></div></div></strong></div></div></strong></div></div></strong></div></div></strong></span></div></div></strong><div><span><strong> </strong></span><strong>at $Proxy21.setConfigName(Unknown Source)</strong></div><div><span><strong> </strong></span><strong>at otroMain.Client.llamadoEstatica(Client.java:57)</strong></div><div><span><strong> </strong></span><strong>at otroMain.Client.main(Client.java:42)</strong></div><div><strong>Caused by: java.lang.reflect.InvocationTargetException</strong></div><div><span><strong> </strong></span><strong>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)</strong></div><div><span><strong> </strong></span><strong>at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)</strong></div><div><span><strong> </strong></span><strong>at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)</strong></div><div><span><strong> </strong></span><strong>at java.lang.reflect.Method.invoke(Method.java:597)</strong></div><div><span><strong> </strong></span><strong>at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:111)</strong></div><div><span><strong> </strong></span><strong>... 3 more</strong></div><div><strong><span>Caused by: org.jboss.ws.WSException: Invalid config namespace: </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></strong></div><div><span><strong> </strong></span><strong>at org.jboss.ws.metadata.config.JBossWSConfigFactory.parse(JBossWSConfigFactory.java:94)</strong></div><div><span><strong> </strong></span><strong>at org.jboss.ws.metadata.config.JBossWSConfigFactory.getConfig(JBossWSConfigFactory.java:151)</strong></div><div><span><strong> </strong></span><strong>at org.jboss.ws.metadata.umdm.EndpointMetaData.initEndpointConfigMetaData(EndpointMetaData.java:923)</strong></div><div><span><strong> </strong></span><strong>at org.jboss.ws.metadata.umdm.EndpointMetaData.createEndpointConfigMetaData(EndpointMetaData.java:889)</strong></div><div><span><strong> </strong></span><strong>at org.jboss.ws.metadata.umdm.ClientEndpointMetaData.createEndpointConfigMetaData(ClientEndpointMetaData.java:83)</strong></div><div><span><strong> </strong></span><strong>at org.jboss.ws.metadata.umdm.FeatureAwareClientEndpointMetaDataAdapter.createEndpointConfigMetaData(FeatureAwareClientEndpointMetaDataAdapter.java:120)</strong></div><div><span><strong> </strong></span><strong>at org.jboss.ws.core.jaxws.client.ClientImpl.setConfigName(ClientImpl.java:492)</strong></div></span></div><div style="display: inline !important;"><span><br/></span></div><div style="display: inline !important;"> </div><div style="display: inline !important;"><span style="font-weight: normal;">thanks, </span></div><div style="display: inline !important;"><span style="font-weight: normal;"><br/></span></div><div style="display: inline !important;"><span style="font-weight: normal;">jp</span></div><div style="display: inline !important;"><span style="font-weight: normal;"><strong><br/></strong></span></div></div></strong></span></div></div></strong></div></div></strong></div></div></strong></div></div></strong></span></div></div></strong></div></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/548245#548245">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>