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