Willem,
I still can't get it to use a proxy. I've spent the last two hours
attempting to dig into the spring schema extensions that implement the
http-config:client tag to understand what it is doing and see if there was
some other way to accomplish this. But the
org.apache.cxf.transports.http.configuration.HTTPClientPolicy.java file
referenced by the
org.apache.cxf.transport.http.spring.HttpConduitBeanDefinitionParser isn't
found in the source distribution of either the zipped version or the tar/gz
version. So that was a dead end. Are those out of date? I suppose I'll have
to check out from svn some time to be more up to date.
So here are the bean definitions in my clientBeans.xml file followed by what
I believe are the key pieces from the WSDL served up from the service from
which I obtained what I believe I should be placing in the
http-config:client's name attribute based upon the documentation and your
suggestions. But when I run the client code the proxy on my local host is
not getting hit and the call to the service is working just fine. So it
isn't using the proxy.
<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>
<http-conf:conduit
name="{http://spring.demo/}HelloWorldImplService.http-conduit">
<http-conf:client Connection="Keep-Alive"
ProxyServer="localhost"
ProxyServerPort="8888"
AllowChunking="false" />
</http-conf:conduit>
And the core pieces from the WSDL are:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:ns1="http://spring.demo/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="HelloWorldImplService"
targetNamespace="http://spring.demo/">
<wsdl:types>
...
<wsdl:service name="HelloWorldImplService">
<wsdl:port binding="ns1:HelloWorldImplServiceSoapBinding"
name="HelloWorldImplPort">
<soap:address location="http://localhost:8080/cxfs/ws/HelloWorld"/>
</wsdl:port>
</wsdl:service>
So where am I messing up?
Thanks.
Mark
Willem Jiang-2 wrote:
>
> Hi Mark,
>
> It's my fault that I did not found the user doc was out of time. I will
> fix it right now.
> Please change the
>
> <http-conf:conduit
> id="{http://spring.demo/}HelloWorldImplService.http-conduit">
> <http-conf:client Connection="Keep-Alive"
> ProxyServer="localhost"
> ProxyServerPort="8888"
> AllowChunking="false" />
> </http-conf:conduit>
>
> to
>
> <http-conf:conduit
> name="{http://spring.demo/}HelloWorldImplService.http-conduit">
> <http-conf:client Connection="Keep-Alive"
> ProxyServer="localhost"
> ProxyServerPort="8888"
> AllowChunking="false" />
> </http-conf:conduit>
>
> Because spring will take a Qname like string as the 'id' attributer's
> value when the schema validation is open.
>
>
> Willem.
>
>
>
>
> mark.boyd wrote:
>> I tried this and it failed with:
>>
>> Aug 8, 2007 4:03:20 PM
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
>> loadBeanDefinitions
>> INFO: Loading XML bean definitions from class path resource
>> [demo/spring/client/clientBeans.xml]
>> Exception in thread "main"
>> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
>> Line
>> 38 in XML document from class path resource [demo/spring/client/cli
>> entBeans.xml] is invalid; nested exception is
>> org.xml.sax.SAXParseException:
>> cvc-datatype-valid.1.2.1:
>> '{http://spring.demo/}HelloWorldImplService.http-conduit' is not a
>> valid value for 'NCName'.
>>
>> The client-beans.xml file now looks as shown below. I'm not certain of
>> the
>> conduit ID. I used the targetnamespace defined in the wsdl served up from
>> the service and the name attribute of the port. But this doesn't appear
>> to
>> be the cause of the error above.
>>
>> <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:http-conf="http://cxf.apache.org/transports/http/configuration"
>> 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
>> http://cxf.apache.org/transports/http/configuration
>> http://cxf.apache.org/schemas/configuration/http-conf.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>
>>
>> <http-conf:conduit
>> id="{http://spring.demo/}HelloWorldImplService.http-conduit">
>> <http-conf:client Connection="Keep-Alive"
>> ProxyServer="localhost"
>> ProxyServerPort="8888"
>> AllowChunking="false" />
>> </http-conf:conduit>
>>
>> </beans>
>>
>> Thanks.
>>
>> Mark
>>
>>
>>
>> Willem Jiang-2 wrote:
>>
>>> 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
>>>>
>>>>
>>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/using-HTTP-firewall-proxy-with-CXF-Spring-config-tf4232625.html#a12078266
Sent from the cxf-user mailing list archive at Nabble.com.