building a WS Client with WS-Security
jplistero Jun 16, 2010 9:10 AMHi all,
I' am trying to build a web service client and sing the soap message.
I 'am using jbossws-cxf to generate the Stubs with wsconsume tool.
My first problem is to build the jboss-wsse-client.xml ...
I have my private key, my sing cert and the CA root for the server (I havent access to the server)
to build a keystore I use:
openssl pkcs12 -export -chain -in mySing.crt -CAfile root.cer -inkey myPrivate.key -out keystore.pkcs12
(I made a client with a soapui tool, and the keystore works fine)
so ... my jboss-wsse-client.xml:
<config>
<sign type="x509v3" alias="1" />
<requires>
<signature />
</requires>
</config>
</jboss-ws-security>
And in my Client, this is my code:
System.setProperty("org.jboss.ws.wsse.keyStore","/home/jp/tmp/keystore.pkcs12");
System.setProperty("org.jboss.ws.wsse.keyStorePassword", "12345");
System.setProperty("org.jboss.ws.wsse.keyStoreType", "pkcs");
SomeService service = new SomeService();
SomePort port = service.getPort();
URL securityURL = new File("/home/jp/workspace1/myProject/src/META-INF/jboss-wsse-client.xml").toURL();
((StubExt) port).setSecurityConfig(securityURL.toExternalForm());
((StubExt) port).setConfigName("Standard WSSecurity Client","/home/jp/workspace1
/myProject
/src/META-INF/jboss-wsse-client.xml");
also I add reference to jboss-AS-5.1/lib/endoresed and jboss-AS-5.1/client
Someone known what is Wrong ? the jboss-wsse-client.xml ? the Client ? the references jars ?
now I'am having this exception
java.lang.reflect.UndeclaredThrowableException
at $Proxy21.setConfigName(Unknown Source)
at otroMain.Client.llamadoEstatica(Client.java:57)
at otroMain.Client.main(Client.java:42)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:111)
... 3 more
Caused by: org.jboss.ws.WSException: Invalid config namespace: http://www.jboss.com/ws-security/config
at org.jboss.ws.metadata.config.JBossWSConfigFactory.parse(JBossWSConfigFactory.java:94)
at org.jboss.ws.metadata.config.JBossWSConfigFactory.getConfig(JBossWSConfigFactory.java:151)
at org.jboss.ws.metadata.umdm.EndpointMetaData.initEndpointConfigMetaData(EndpointMetaData.java:923)
at org.jboss.ws.metadata.umdm.EndpointMetaData.createEndpointConfigMetaData(EndpointMetaData.java:889)
at org.jboss.ws.metadata.umdm.ClientEndpointMetaData.createEndpointConfigMetaData(ClientEndpointMetaData.java:83)
at org.jboss.ws.metadata.umdm.FeatureAwareClientEndpointMetaDataAdapter.createEndpointConfigMetaData(FeatureAwareClientEndpointMetaDataAdapter.java:120)
at org.jboss.ws.core.jaxws.client.ClientImpl.setConfigName(ClientImpl.java:492)
thanks,
jp