[jboss-user] [JBossWS] - Re: Java Client Application using Stub with WS-Security

method_ben do-not-reply at jboss.com
Thu Nov 29 09:22:26 EST 2007


I tried your suggestion :

package com.main;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.naming.NamingException;
import javax.xml.namespace.QName;
import javax.xml.rpc.Stub;

import org.jboss.ws.core.StubExt;
import com.client.*;



public class MainTest {

	public static void main(String[] args) throws MalformedURLException, NamingException 
	{
		System.setProperty("org.jboss.ws.wsse.keyStore", "etc/wsse.keystore"); 
		System.setProperty("org.jboss.ws.wsse.trustStore", "etc/wsse.truststore"); 
		System.setProperty("org.jboss.ws.wsse.keyStorePassword", "mypass"); 
		System.setProperty("org.jboss.ws.wsse.trustStorePassword", "mypass"); 
		System.setProperty("org.jboss.ws.wsse.keyStoreType", "jks"); 
		System.setProperty("org.jboss.ws.wsse.trustStoreType", "jks"); 
				
		URL url = new URL("http://127.0.0.1:8080/test/Test?wsdl");
        QName qName = new QName("rrr", "TestService");
        
        TestService service = new TestService(url,qName);
		Test ws = service.getPort(Test.class);
		
		((StubExt) ws).setSecurityConfig(new File("etc/jboss-wsse-client.xml").toURI().toURL().toExternalForm());
		((StubExt) ws).setConfigName("Standard WSSecurity Client");
		
		ws.hello("Benoit"); // doesnt work !
	}

}

jboss-wwse-client.xml :

<?xml version="1.0" encoding="UTF-8"?>

<jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" 
       			   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
       			   xsi:schemaLocation="http://www.jboss.com/ws-security/config   
         		   http://www.jboss.com/ws-security/schema/jboss-ws-security_1_0.xsd">
	
	
   		
    	
    	
       		
      		
       	
	
	
</jboss-ws-security>

Generate my keystore and my truststore with this command line :

keytool -genkey -alias wsse -keyalg RSA -keypass mypass -storepass mypass -keystore c:/wsse.keystore

keytool -export -alias wsse -storepass mypass -file c:/server.cer -keystore c:/wsse.keystore

keytool -import -v -trustcacerts -alias wsse -file c:/server.cer -keystore c:/wsse.truststore -keypass mypass -storepass mypass

and I still get this error :

Exception in thread "main" javax.xml.ws.WebServiceException: org.jboss.ws.core.CommonSOAPFaultException: An internal WS-Security error occurred. See log for details
	at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.processHandlerFailure(HandlerChainExecutor.java:276)
	at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:155)
	at org.jboss.ws.core.jaxws.client.ClientImpl.callRequestHandlerChain(ClientImpl.java:160)
	at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:297)
	at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:243)
	at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164)
	at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
	at $Proxy14.hello(Unknown Source)
	at com.main.MainTest.main(MainTest.java:35)
Caused by: org.jboss.ws.core.CommonSOAPFaultException: An internal WS-Security error occurred. See log for details
	at org.jboss.ws.extensions.security.WSSecurityDispatcher.convertToFault(WSSecurityDispatcher.java:105)
	at org.jboss.ws.extensions.security.WSSecurityDispatcher.handleOutbound(WSSecurityDispatcher.java:314)
	at org.jboss.ws.extensions.security.jaxws.WSSecurityHandler.handleOutboundSecurity(WSSecurityHandler.java:95)
	at org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerClient.handleOutbound(WSSecurityHandlerClient.java:45)
	at org.jboss.ws.core.jaxws.handler.GenericHandler.handleMessage(GenericHandler.java:55)
	at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:295)
	at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:140)
	... 7 more

server.log (jboss_folder/server/default/log):

2007-11-29 09:20:58,342 DEBUG [org.jboss.wsf.stack.jbws.RequestHandlerImpl] handleWSDLRequest: jboss.ws:context=test,endpoint=Test
2007-11-29 09:20:58,342 DEBUG [org.jboss.wsf.stack.jbws.RequestHandlerImpl] WSDL request, using host: 127.0.0.1
2007-11-29 09:20:58,451 DEBUG [org.jboss.wsf.stack.jbws.RequestHandlerImpl] handleWSDLRequest: jboss.ws:context=test,endpoint=Test
2007-11-29 09:20:58,451 DEBUG [org.jboss.wsf.stack.jbws.RequestHandlerImpl] WSDL request, using host: 127.0.0.1
2007-11-29 09:20:58,545 DEBUG [org.jboss.wsf.stack.jbws.RequestHandlerImpl] handleWSDLRequest: jboss.ws:context=test,endpoint=Test
2007-11-29 09:20:58,545 DEBUG [org.jboss.wsf.stack.jbws.RequestHandlerImpl] WSDL request, using host: 127.0.0.1

My setup :

jboss-4.2.2.GA
jbossws-2.0.2.GA
JDK 6 update 3

Thank you very much for your help !

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108888#4108888

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108888



More information about the jboss-user mailing list