http://www.jroller.com/gmazza/entry/creating_a_wsdl_first_web1 ?
bmelloni wrote:
>
> I attempted to follow the How-To for writing a HelloWorld service with
> Spring. It is obvious that once you figure out the secrets CXF makes
> writing services very easy. Unfortunately I a missing something because I
> get some strange uninformative error messages (shown at the bottom).
>
> I suspect that the problem is either a JAR issue or a problem with the
> path to the service - but I don't see it :P
>
> Any help would be greatly appreciated.
>
> Major software versions:
>
> CXF 2.2.2
> Java 6
> Tomcat 6
> Spring 2.5.6
> Eclipse 3.4.2 (Ganymede)
>
> JARs in WEB-INF/lib:
>
> commons-logging-1.1.1.jar
> cxf-2.2.2.jar
> geronimo-activation_1.1_spec-1.0.2.jar
> geronimo-annotation_1.0_spec-1.1.1.jar
> geronimo-javamail_1.4_spec-1.6.jar
> geronimo-jaxws_2.1_spec-1.0.jar
> geronimo-servlet_2.5_spec-1.2.jar
> geronimo-stax-api_1.0_spec-1.0.1.jar
> geronimo-ws-metadata_2.0_spec-1.1.2.jar
> jaxb-api-2.1.jar
> jaxb-impl-2.1.9.jar
> neethi-2.0.4.jar
> saaj-api-1.3.jar
> saaj-impl-1.3.2.jar
> spring-2.5.6.jar
> wsdl4j-1.6.2.jar
> wstx-asl-3.2.8.jar
> xml-resolver-1.2.jar
> XmlSchema-1.4.5.jar
>
> The interface and Impl:
>
> @WebService
> public interface HelloWorld {
> String sayHi(String text);
> }
>
> @WebService (endpointInterface = "net.cndc.utility.email.ws.HelloWorld")
> public class HelloWorldImpl {
> public String sayHi(String text) {
> System.out.println("sayHi called");
> return "Hello "+text;
> }
> }
>
> The service spring context and web.xml are:
>
> <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">
>
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
> <jaxws:endpoint id="helloWorld" address="/services/HelloWorld"
> implementor="net.cndc.utility.email.ws.HelloWorldImpl" />
> <!-- If we want a context-accessible managed bean for the WS, use this
> instead:
> <bean id="hello" class="net.cndc.utility.email.ws.HelloWorldImpl" />
> <jaxws:endpoint id="helloWorld" address="/HelloWorld"
> implementor="#hello" />
> -->
>
> </beans>
>
> <web-app id="WebApp_ID" version="2.5"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>
> <display-name>UtilityWS</display-name>
>
> <!-- Where to load application contexts from (besides the Spring MVC
> context) -->
> <context-param>
> <param-name>contextConfigLocation</param-name>
>
> <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value>
> </context-param>
> <listener>
>
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> </listener>
>
> <servlet>
> <display-name>CXF Servlet</display-name>
> <servlet-name>CXFServlet</servlet-name>
>
> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>CXFServlet</servlet-name>
> <url-pattern>/services/*</url-pattern>
> </servlet-mapping>
>
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
> </web-app>
>
> The client context and code are:
>
> <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">
>
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
> <!-- Client side: -->
> <jaxws:client id="helloClient"
> address="http://localhost:8080/services/HelloWorld"
> serviceClass="net.cndc.utility.email.ws.HelloWorld" />
>
> </beans>
>
> package net.cndc.utility.email.test;
>
> import net.cndc.utility.email.ws.HelloWorld;
>
> import org.springframework.context.ApplicationContext;
> import org.springframework.context.support.ClassPathXmlApplicationContext;
>
> public class WsTest {
>
> public static void main(String[] args) {
> ApplicationContext context = new ClassPathXmlApplicationContext(
> new String[] {"applicationContext-client.xml"});
> HelloWorld client = (HelloWorld) context.getBean("helloClient");
> String msg = client.sayHi("ding dong da dong");
> System.out.println("WS called - response: "+msg);
> }
> }
>
> And finally, the error is:
>
> Jul 2, 2009 1:45:49 PM
> org.springframework.context.support.AbstractApplicationContext
> prepareRefresh
> INFO: Refreshing
> org.springframework.context.support.classpathxmlapplicationcont...@1a05308:
> display name
> [org.springframework.context.support.classpathxmlapplicationcont...@1a05308];
> startup date [Thu Jul 02 13:45:49 CDT 2009]; root of context hierarchy
> Jul 2, 2009 1:45:49 PM
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> loadBeanDefinitions
> INFO: Loading XML bean definitions from class path resource
> [applicationContext-client.xml]
> Jul 2, 2009 1:45:49 PM
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> loadBeanDefinitions
> INFO: Loading XML bean definitions from class path resource
> [META-INF/cxf/cxf.xml]
> Jul 2, 2009 1:45:49 PM
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> loadBeanDefinitions
> INFO: Loading XML bean definitions from class path resource
> [META-INF/cxf/cxf-extension-soap.xml]
> Jul 2, 2009 1:45:49 PM
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> loadBeanDefinitions
> INFO: Loading XML bean definitions from class path resource
> [META-INF/cxf/cxf-servlet.xml]
> Jul 2, 2009 1:45:50 PM
> org.springframework.context.support.AbstractApplicationContext
> obtainFreshBeanFactory
> INFO: Bean factory for application context
> [org.springframework.context.support.classpathxmlapplicationcont...@1a05308]:
> org.springframework.beans.factory.support.defaultlistablebeanfact...@12a0f6c
> Jul 2, 2009 1:45:50 PM
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> preInstantiateSingletons
> INFO: Pre-instantiating singletons in
> org.springframework.beans.factory.support.defaultlistablebeanfact...@12a0f6c:
> defining beans
> [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,helloClient.proxyFactory,helloClient];
> root of factory hierarchy
> Jul 2, 2009 1:45:50 PM
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromClass
> INFO: Creating Service
> {http://ws.email.utility.cndc.net/}HelloWorldService from class
> net.cndc.utility.email.ws.HelloWorld
> Jul 2, 2009 1:45:50 PM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not send Message.
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:471)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:301)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253)
> at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:121)
> at $Proxy34.sayHi(Unknown Source)
> at net.cndc.utility.email.test.WsTest.main(WsTest.java:14)
> Caused by: java.io.IOException: Not Found
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2064)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2015)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1940)
> at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:627)
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> ... 8 more
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not
> send Message.
> at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:141)
> at $Proxy34.sayHi(Unknown Source)
> at net.cndc.utility.email.test.WsTest.main(WsTest.java:14)
> Caused by: java.io.IOException: Not Found
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2064)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2015)
> at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1940)
> at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
> at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:627)
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:471)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:301)
> at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253)
> at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:121)
> ... 2 more
>
>
>
--
View this message in context:
http://www.nabble.com/Help-with-%27Hello-World%27-%22Writing-a-service-with-Spring%27-please-tp24312387p24312497.html
Sent from the cxf-user mailing list archive at Nabble.com.