Benson.
Made some progress. First, found this problem with the JAX-WS config
example here: http://cwiki.apache.org/CXF20DOC/aegis-databinding.html
In the commented out XFIRE compat stuff there is '--' within the XML
comments. That apparently is a SAX no-no. This was causing my
configuration woes. I shamefully admit I found this by looking at my
Tomcat logs.
Now...my service and client are running. But, now I'm getting an
error on the HashMap read...and not just an empty HashMap plus my
other interfaces aren't working either.
Here's the error:
Tests run: 2, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 4.219
sec <<< FAILURE!
testGetAllSettings
(com.XXXXXX.nettoolkit.test.NctGlobalSettingsAcceptanceTest) Time
elapsed: 3.652 sec <<< ERROR!
javax.xml.ws.soap.SOAPFaultException: Fault occurred while processing.
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:
218)
at $Proxy30.getAllSettings(Unknown Source)
at
com
.XXXXXX
.nettoolkit
.settings.NctGlobalSettings.getAllSettings(NctGlobalSettings.java:114)
at com.
XXXXXX
.nettoolkit
.test
.NctGlobalSettingsAcceptanceTest
.testGetAllSettings(NctGlobalSettingsAcceptanceTest.java:55)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at
org
.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:
35)
at
org
.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:
62)
at
org
.apache
.maven
.surefire
.suite
.AbstractDirectoryTestSuite
.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org
.apache
.maven
.surefire
.suite
.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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:585)
at
org
.apache
.maven
.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:
345)
at
org
.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:
1009)
Caused by: org.apache.cxf.binding.soap.SoapFault: Fault occurred while
processing.
at
org
.apache
.cxf
.binding
.soap
.interceptor
.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:
70)
at
org
.apache
.cxf
.binding
.soap
.interceptor
.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:
35)
at
org
.apache
.cxf
.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
at
org
.apache
.cxf
.interceptor
.AbstractFaultChainInitiatorObserver
.onMessage(AbstractFaultChainInitiatorObserver.java:96)
at
org
.apache
.cxf
.binding
.soap
.interceptor
.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:65)
at
org
.apache
.cxf
.binding
.soap
.interceptor
.CheckFaultInterceptor.handleMessage(CheckFaultInterceptor.java:34)
at
org
.apache
.cxf
.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:429)
at org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.handleResponse(HTTPConduit.java:1988)
at org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.close(HTTPConduit.java:1824)
at
org
.apache
.cxf
.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:
47)
at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:
159)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:
583)
at org.apache.cxf.interceptor.MessageSenderInterceptor
$
MessageSenderEndingInterceptor
.handleMessage(MessageSenderInterceptor.java:62)
at
org
.apache
.cxf
.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:
177)
... 26 more
testGetSetting(com.
XXXXXX.nettoolkit.test.NctGlobalSettingsAcceptanceTest) Time elapsed:
0.136 sec <<< FAILURE!
junit.framework.ComparisonFailure: Failure retrieving setting
expected:<test> but was:<null>
at junit.framework.Assert.assertEquals(Assert.java:81)
at com.
XXXXXX
.nettoolkit
.test
.NctGlobalSettingsAcceptanceTest
.testGetSetting(NctGlobalSettingsAcceptanceTest.java:70)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at
org
.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:
35)
at
org
.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:
62)
at
org
.apache
.maven
.surefire
.suite
.AbstractDirectoryTestSuite
.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org
.apache
.maven
.surefire
.suite
.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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:585)
at
org
.apache
.maven
.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:
345)
at
org
.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:
1009)
My client is set up programmatically...here's a snip:
public class NctGlobalSettings implements NctGlobalSettingsInf {
private final static Logger LOG =
Logger.getLogger("NctGlobalSettings");
private final static String USER_MANAGER_CONTEXT = "/user-manager";
private final static String SERVICE_NAME = "/globalSettings";
private final static String SERVICE_URL = "https://" + getTestHost()
+ ":" + getTestPort() + USER_MANAGER_CONTEXT + "/services" +
SERVICE_NAME;
Map<String, Object> wss4jOutProps = new HashMap<String, Object>();
SettingsManager globalSettingsClient;
public NctGlobalSettings() {
// setup the properties for WS-Security. This is basic username/
password
// authentication, with the password cleartext as specified by
PW_TEXT
wss4jOutProps.put(WSHandlerConstants.ACTION,
"Signature");
wss4jOutProps.put(WSHandlerConstants.USER, "ws-
client");
wss4jOutProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,
ClientPasswordCallback.class.getName());
wss4jOutProps.put(WSHandlerConstants.SIG_PROP_FILE,
"client-sign.properties");
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
// debugging to stndout
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
// WS-Security uses saaj and wss4j interceptors
factory.getOutInterceptors().add(new SAAJOutInterceptor());
factory.getOutInterceptors().add(new
WSS4JOutInterceptor(wss4jOutProps));
factory.setAddress(SERVICE_URL);
factory.setServiceClass(SettingsManager.class);
globalSettingsClient = (SettingsManager)factory.create();
// for development, accept all certificates from tomcat
Client proxy = ClientProxy.getClient(globalSettingsClient);
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
TLSClientParameters tcp = new TLSClientParameters();
tcp.setTrustManagers(CertificateAcceptorCXF.acceptAllCerts());
// for ws-security, The https URL hostname does not match the
// Common Name (CN) on the server certificate. this is development
only
tcp.setDisableCNCheck(true);
conduit.setTlsClientParameters(tcp);
}
// Public Accessor Methods
// TODO throw a useful/custom exception
public List<String> getAllSettingKeys() {
List<String> settings = null;
settings = globalSettingsClient.list("global");
return settings;
}
/**
[EMAIL PROTECTED]
*globalnamespace.
*/
public HashMap<String, String> getAllSettings() {
return globalSettingsClient.getAllSettings("global");
}
Kit
On May 23, 2008, at 4:05 PM, Benson Margulies wrote:
OK, to start with, the unhappy HashMap is not such a surprise without
Aegis, as you have to use a type adapter with JAXB to deal with a hash
map.
The IO exception with Aegis -- now -- that's a surprise to me.
You don't want the XFire compatibility service configuration, but
it's harmless.
How do you configure your client? Also JAXWS+Aegis, I trust?
I don't suppose you might be willing to try to cook up a test case we
could run and attach it to a JIRA?
I should also say that this is very faintly ringing a bell, and when
Dan sees this thread he might know what is going on. So I hate to ask
you to spend a lot of time on this until he wanders by.
On Fri, May 23, 2008 at 6:58 PM, Kit Plummer <[EMAIL PROTECTED]>
wrote:
Yes, CXF (same version, now 2.1) on both sides.
So, with my config looking like this (notice didn't chance the
jaxw:endpoint
either):
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:wsa="http://cxf.apache.org/ws/addressing"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-
soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding"
scope="prototype" />
<bean id="jaxws-and-aegis-service-factory"
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
scope="prototype">
<property name="dataBinding" ref="aegisBean" />
<!-- Use this property only for XFire compatibility
-- this
version for 2.0.x ...
<property name="serviceConfigurations">
<list>
<bean
class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
<bean
class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration"/>
<bean
class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
</list>
</property>
-->
<!-- Use this property only for XFire compatibility
-- this
version for 2.1
<property name="serviceConfigurations">
<list>
<bean
class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
<bean
class
=
"org
.apache
.cxf.aegis.databinding.XFireCompatibilityServiceConfiguration"/>
<bean
class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
</list>
</property>
-->
</bean>
<jaxws:endpoint id="Controller"
implementor="com.accenture.manager.Controller"
address="/controller" />
<jaxws:endpoint id="UserSettings"
implementor="com.accenture.manager.settings.UserSettingsManager"
address="/userSettings" />
<jaxws:endpoint id="GlobalSettings"
implementor="com.accenture.manager.settings.GlobalSettingsManager"
address="/globalSettings">
<!-- signed and encrypted -->
<jaxws:inInterceptors>
<bean
class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" />
<bean
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry key="action"
value="Signature" />
<entry
key="signaturePropFile"
value="server-sign.properties" />
</map>
</constructor-arg>
</bean>
</jaxws:inInterceptors>
</jaxws:endpoint>
</beans>
I get errors on the client side:
May 23, 2008 3:55:16 PM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at
org.apache.cxf.interceptor.MessageSenderInterceptor
$
MessageSenderEndingInterceptor
.handleMessage(MessageSenderInterceptor.java:64)
at
org
.apache
.cxf
.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:
221)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:
276)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:
222)
at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:
177)
at $Proxy31.addSetting(Unknown Source)
at
com
.XXXXXXX
.nettoolkit
.settings.NctGlobalSettings.setSetting(NctGlobalSettings.java:119)
at
com
.XXXXXXX
.nettoolkit
.test
.NctGlobalSettingsAcceptanceTest
.testGetSetting(NctGlobalSettingsAcceptanceTest.java:68)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at
org
.junit
.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at
org
.apache
.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org
.apache
.maven
.surefire
.suite
.AbstractDirectoryTestSuite
.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org
.apache
.maven
.surefire
.suite
.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:
127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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:585)
at
org
.apache
.maven
.surefire
.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at
org
.apache
.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
Caused by: java.io.IOException: /user-manager/services/globalSettings
at
org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.handleResponse(HTTPConduit.java:1921)
at
org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.close(HTTPConduit.java:1824)
at
org
.apache
.cxf
.io
.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:
47)
at
org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:
159)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:
66)
at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:583)
at
org.apache.cxf.interceptor.MessageSenderInterceptor
$
MessageSenderEndingInterceptor
.handleMessage(MessageSenderInterceptor.java:62)
... 31 more
Without the aegis beans I don't get any errors, just an empty
HashMap. I
was trying to use the Aegis data binding to get my HashMap across
the wire.
Thanks again.
Kit
On May 23, 2008, at 3:41 PM, Benson Margulies wrote:
My first suggestion is to take out all the security stuff and see
what
happens.
Do you have CXFon both ends here?
Also, can you tell me more about that awful thing happens when you
change the config?