Unclear error messages given if client policy configuration can't be found.
---------------------------------------------------------------------------

                 Key: CXF-4054
                 URL: https://issues.apache.org/jira/browse/CXF-4054
             Project: CXF
          Issue Type: Bug
            Reporter: Glen Mazza
            Assignee: Glen Mazza
            Priority: Minor


Dennis has noted: 
http://cxf.547215.n5.nabble.com/Invalid-property-bus-of-bean-class-error-Spring-problem-tp5163771p5165056.html

With this tutorial: 
http://www.jroller.com/gmazza/entry/cxf_x509_profile_secpol, in particular, the 
WSC config file within it:

<beans xmlns="http://www.springframework.org/schema/beans";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xmlns:jaxws="http://cxf.apache.org/jaxws";
   xsi:schemaLocation="http://www.springframework.org/schema/beans 
   http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
   http://cxf.apache.org/jaxws 
   http://cxf.apache.org/schemas/jaxws.xsd";>

   <jaxws:client name="{http://www.example.org/contract/DoubleIt}DoubleItPort"; 
createdFromAPI="true">
      <jaxws:properties>
         <entry key="ws-security.callback-handler" 
value="client.ClientKeystorePasswordCallback"/>        
         <entry key="ws-security.encryption.properties" 
value="clientKeystore.properties"/>
         <entry key="ws-security.signature.properties" 
value="clientKeystore.properties"/>
         <entry key="ws-security.encryption.username" value="myservicekey"/>
      </jaxws:properties>
   </jaxws:client>

</beans>

Usage of an incorrect port name in the "name" attribute of the jaxws:client 
element gives unhelpful/confusing error messages.  

If the port name doesn't exist at all (e.g., 
"{http://www.example.org/contract/DoubleIt}DoubleItXYZ";), the reader gets this 
error:

WARNING: Interceptor for 
{http://www.example.org/contract/DoubleIt}DoubleItService#{http://www.example.org/contract/DoubleIt}DoubleIt
 has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No signature username found.
        at 
org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.doSignBeforeEncrypt(AsymmetricBindingHandler.java:172)
        at 
org.apache.cxf.ws.security.wss4j.policyhandlers.AsymmetricBindingHandler.handleBinding(AsymmetricBindingHandler.java:96)
        at 
org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:164)
        at 
org.apache.cxf.ws.security.wss4j.PolicyBasedWSS4JOutInterceptor$PolicyBasedWSS4JOutInterceptorInternal.handleMessage(PolicyBasedWSS4JOutInterceptor.java:88)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
        at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
        at $Proxy24.doubleIt(Unknown Source)
        at client.WSClient.doubleIt(WSClient.java:28)
        at client.WSClient.main(WSClient.java:21)

I'm not sure what should be done in this case -- because a non-matching port 
name like the above should indeed be ignored (as it could refer to another port 
in another WSDL), but perhaps a clearer error given that no configuration was 
provided for the client endpoint for the port being used.

If the service name was erroneously used instead of the port name, this error 
is given:

Exception in thread "main" 
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name '{http://www.example.org/contract/DoubleIt}DoubleItService': Error 
setting property values; nested exception is 
org.springframework.beans.NotWritablePropertyException: Invalid property 'bus' 
of bean class [org.apache.cxf.service.ServiceImpl]: Bean property 'bus' is not 
writable or has an invalid setter method. Does the parameter type of the setter 
match the return type of the getter?
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)

Here, an error message given that the port, and not the service name, should be 
referred to.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to