On 8/6/07 3:22 AM, "lllgg" <[EMAIL PROTECTED]> wrote:

I would use ClassPathXmlApplicationContext instead of ClassPathResource.

ClassPathXmlApplicationContext res = new
ClassPathXmlApplicationContext("applicationContext.xml");
HelloWorld client = (HelloWorld) res.getBean("testclient");

This assumes that applicationContext.xml is in the root of your classpath,
like the src directory in an Eclipse project for instance, and that
testclient is properly defined in your application context.

Randy Burgess


> 
> hi,everyone
> I have a try to start the spring demo,I achieved the web services server and
> the wsdl2java client and they works fine.and now I want to write the spring
> client for inject to other codes,the code just sounds like the follow:   i
> used the latest snapshot CXF on 29-july-08.
> ClassPathResource res = new ClassPathResource("applicationContext.xml");
> BeanFactory ac = new XmlBeanFactory(res);
> HelloWorld client = (HelloWorld) ac.getBean("testclient");
>         String _synchronousRole__return = client.sayHi("test for
> HelloWorld");
>         System.out.println("Invoking sayHi... and return : " +
> _synchronousRole__return);
> and the applicationContext.xml is like:
> <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";>
>  
>   <bean id="proxyFactory"
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>     <property name="serviceClass" value="demo.spring.HelloWorld"/>
>     <property name="address"
> value="http://laishenlu.arp.cn:8080/synchronous/webservices/HelloWorld"/>
>   </bean>
>  
>   <bean id="testclient" class="demo.spring.HelloWorld"
>     factory-bean="proxyFactory" factory-method="create"/>
> </beans>
> 
> when i run the spring client ,I got the errrors as follow.How cant i fix the
> error, any help are appreciate!!.
> errors:
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Error
> reading XMLStreamReader.
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:169)
> at $Proxy32.sayHi(Unknown Source)
> at demo.spring.HelloTest.main(HelloTest.java:14)
> Caused by: org.apache.cxf.binding.soap.SoapFault: Error reading
> XMLStreamReader.
> at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage
> (Soap11FaultInInterceptor.java:69)
> at
> org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage
> (Soap11FaultInInterceptor.java:1)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.j
> ava:207)
> at
> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(Abstr
> actFaultChainInitiatorObserver.java:90)
> at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(R
> eadHeadersInterceptor.java:178)
> at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(R
> eadHeadersInterceptor.java:1)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.j
> ava:207)
> at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:395)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(H
> TTPConduit.java:1959)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPCondui
> t.java:1806)
> at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:574)
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterce
> ptor.handleMessage(MessageSenderInterceptor.java:62)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.j
> ava:207)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
> at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
> ... 2 more




This email and any attachments ("Message") may contain legally privileged 
and/or confidential information.  If you are not the addressee, or if this 
Message has been addressed to you in error, you are not authorized to read, 
copy, or distribute it, and we ask that you please delete it (including all 
copies) and notify the sender by return email.  Delivery of this Message to any 
person other than the intended recipient(s) shall not be deemed a waiver of 
confidentiality and/or a privilege.

Reply via email to