Hi Mark,

You need to do some conduit setting work[1].
The proxy server setting could be

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

 <http-conf:conduit 
name="{http://apache.org/hello_world_soap_http}SoapPort.http-conduit";>
   <http-conf:client Connection="Keep-Alive"
                     ProxyServer="proxy host"
                     ProxyServerPort="1234"
                     AllowChunking="false" />
 </http-conf:conduit>
</beans>



[1] http://cwiki.apache.org/CXF20DOC/client-http-transport.html


Willem.


mark.boyd wrote:
Does anyone know how to configure a spring configured CXF client to use a
proxy to get through our firewall to an outside service? I've used jvmargs
of -DhttpProxy.port and -DhttpProxy.host but CXF doesn't appear to use the
java.net.URL classes which take these settings into account. When the
service is set up locally on my box and successfully accessed my client
spring configuration file, clientBeans.xml, looks like this:

<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.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>

<bean id="client" class="demo.spring.HelloWorld" factory-bean="clientFactory" factory-method="create"/>
                
        <bean id="clientFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
                <property name="serviceClass" value="demo.spring.HelloWorld"/>
                <property name="address"
value="http://localhost:8080/cxfs/ws/HelloWorld"/>
        </bean>
</beans>

And my client code looks like this:

        ClassPathResource cres = new
ClassPathResource("demo/spring/client/clientBeans.xml");
        BeanFactory fac = new XmlBeanFactory(cres);
        HelloWorld service = (HelloWorld) fac.getBean("client");
        System.out.println("calling: " + service.sayHi("Mark"));

This all works just fine until I move that service outside the firewall and
need to use a proxy. When the client runs outside the firewall things are
again fine. So I know that the service is working. I've even dug into the
source for JaxWsProxyFactoryBean a little bit but got lost fairly quickly.
Any suggestions?

Thanks.

Mark

Reply via email to