HTTP Client ProxyServerPort shouldn't be an xs:int in the http-conf.xsd
-----------------------------------------------------------------------

                 Key: CXF-2324
                 URL: https://issues.apache.org/jira/browse/CXF-2324
             Project: CXF
          Issue Type: Bug
          Components: Transports
    Affects Versions: 2.1.4
            Reporter: Nils Winkler


In the {{cxf-rt-transports-http}} jar, the {{schemas/wsdl/http-conf.xsd}} file 
contains the following definition for the HTTP Client's {{ProxyServerPort}} 
element:

{code:xml}
<xs:attribute name="ProxyServerPort" type="xs:int" use="optional">
        <xs:annotation>
                <xs:documentation>
                Specifies the port number used by the proxy server.
                </xs:documentation>
        </xs:annotation>      
</xs:attribute>
{code}

The use of {{xs:int}} makes it impossible to define the {{ProxyServerPort}} 
value through one of Spring's {{PropertyPlaceholderConfigurer}}, e.g. like this:

{code:xml}
<http:conduit name="{http://xyz.com/abc/service}AbcInterfacePort.http-conduit";>
        <http:client ProxyServer="$(proxy.name)" 
ProxyServerPort="$(proxy.port)"/>

        <http:tlsClientParameters secureSocketProtocol="SSL" />
</http:conduit>
{code}

This fails on startup, since the XML validation of the context fails, 
complaining that {{$(proxy.port)}} is not a valid int value.

I know that one can disable schema validation through a CXF environment 
parameter, but this doesn't work when using a custom Spring context in the web 
application. I had to resort to subclassing Spring's 
{{XmlWebApplicationContext}} class with the following code to successfully 
start the application:

{code}
package com.sungard.banking.spring.web;

import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.web.context.support.XmlWebApplicationContext;

public class NonValidatingXmlWebApplicationContext extends
                XmlWebApplicationContext {
        protected void initBeanDefinitionReader(
                        XmlBeanDefinitionReader beanDefinitionReader) {
                super.initBeanDefinitionReader(beanDefinitionReader);
                
beanDefinitionReader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
                beanDefinitionReader.setNamespaceAware(true);
        }
}
{code}

The same issue is reported in the Spring core project
* http://jira.springframework.org/browse/SPR-3180
* http://jira.springframework.org/browse/SPR-4847

With the mentioned Spring tx bean, it's at least possible to use standard bean 
definitions instead of the XSD-based ones. For HTTP Client, I didn't find any 
examples that would allow me to do that.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to