Anyway, I finally managed to get it to work. Without changing the wsdl
or beans.xml, if I use the following interface and implementation,
then it works as expected.
--- interface ---
package dk.unwire.statistics2;
import javax.jws.*;
import javax.jws.soap.SOAPBinding;
@WebService(
targetNamespace = "http://ws.unwire.dk/webstat/v1",
name = "HelloWorldPort")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public interface HelloWorldPort {
@WebMethod(action = "http://unwire.dk/SayHello", operationName = "SayHello")
@WebResult(name="msg", targetNamespace="http://ws.unwire.dk/webstat/v1")
public String sayHello(
@WebParam(mode = WebParam.Mode.INOUT, partName = "msg", name = "msg")
String msg
);
}
--- /interface ---
--- impl ---
package dk.unwire.statistics2;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
@WebService(
targetNamespace="http://ws.unwire.dk/webstat/v1"
,name="HelloWorldPort"
,serviceName = "HelloWorld"
)
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class HelloWorldPortImpl implements HelloWorldPort{
public String sayHello(String msg) {
return "I greet thee; " + msg + "!";
}
}
--- impl ---
Thanks for all the help.
2007/7/10, Christian Vest Hansen <[EMAIL PROTECTED]>:
That's strange... Why does it generate a method that returns void when
the wsdl clearly states that SayHello outputs an Msg message?
> <wsdl:operation name="SayHello">
> <wsdl:input message="unw:Msg"/>
> <wsdl:output message="unw:Msg"/>
> </wsdl:operation>
2007/7/10, Willem Jiang <[EMAIL PROTECTED]>:
> Hi Christian,
>
> I used the wsd2java to generate the SEI from your wsdl
>
> package dk.unwire.ws.webstat.v1;
>
> import javax.jws.WebParam.Mode;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.WebMethod;
>
> /**
> * This class was generated by the CXF 2.1-incubator-SNAPSHOT
> * Tue Jul 10 18:07:02 CST 2007
> * Generated source version: 2.1-incubator-SNAPSHOT
> *
> */
>
> @WebService(targetNamespace = "http://ws.unwire.dk/webstat/v1", name =
> "HelloWor
> ldPort")
> @SOAPBinding(style = SOAPBinding.Style.RPC)
>
> public interface HelloWorldPort {
>
> @WebMethod(action = "http://unwire.dk/SayHello", operationName =
> "SayHello")
>
> public void sayHello(
> @WebParam(mode = Mode.INOUT, partName = "msg", name = "msg")
> javax.xml.ws.Holder<java.lang.String> msg
> );
> }
>
> It looks like your wsdl is not march with the SEI that you use in your
> impl's WebService annotation.
>
> My suggestion is you remove the wsdlLocation in the beans.xml to let the
> ReflectionServiceFactoryBean to build the service form class, or you
> can change to use the upper SEI to implement your service without
> changing any thing in the beans.xml ( ReflectionServiceFactoryBean will
> build the service from wsdl ).
>
> Hope these can help your out :)
>
> Willem.
>
>
>
> Christian Vest Hansen wrote:
> > The service impl class looks like this with the change you suggested,
> > plus I added the 'name' parameter:
> >
> > package dk.unwire.statistics2;
> > import javax.jws.WebService;
> > @WebService(
> > endpointInterface = "dk.unwire.statistics2.HelloWorld"
> > ,serviceName="HelloWorld"
> > ,targetNamespace="http://ws.unwire.dk/webstat/v1"
> > ,portName="HelloWorldDev"
> > ,name="HelloWorldPort"
> > )
> > public class HelloWorldImpl implements HelloWorld{
> > public String sayHello(String text) {
> > return "I greet thee; " + text + "!";
> > }
> > }
> >
> > But now I'm getting a different exception:
> >
> > 11:38:34,053 DEBUG [DefaultListableBeanFactory] Eagerly caching bean
> > 'helloWorld' to allow for resolving potential circular references
> > 11:38:34,066 ERROR [STDERR] Jul 10, 2007 11:38:34 AM
> > org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> > buildServiceFromWSDL
> > INFO: Creating Service {http://ws.unwire.dk/webstat/v1}HelloWorld from
> > WSDL: classpath:HelloWorld.wsdl
> > 11:38:34,139 DEBUG [DefaultListableBeanFactory] Returning cached
> > instance of singleton bean
> > 'org.apache.cxf.binding.soap.SoapTransportFactory'
> > 11:38:34,169 INFO [DefaultListableBeanFactory] Destroying singletons
> > in
> > [EMAIL PROTECTED]:
> >
> > defining beans
> >
[cxf,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,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.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,helloWorl
> >
> > d];
> > root of factory hierarchy
> > 11:38:34,172 DEBUG [DefaultListableBeanFactory] Retrieved dependent
> > beans for bean
> > 'org.apache.cxf.configuration.spring.SpringBeanMap#42d700':
> > [org.apache.cxf.transport.ConduitInitiatorManager]
> > 11:38:34,174 DEBUG [DefaultListableBeanFactory] Retrieved dependent
> > beans for bean
> > 'org.apache.cxf.configuration.spring.SpringBeanMap#691a61':
> > [org.apache.cxf.transport.DestinationFactoryManager]
> > 11:38:34,174 DEBUG [DefaultListableBeanFactory] Retrieved dependent
> > beans for bean
> > 'org.apache.cxf.configuration.spring.SpringBeanMap#c25152':
> > [org.apache.cxf.binding.BindingFactoryManager]
> > 11:38:34,174 DEBUG [DefaultListableBeanFactory] Retrieved dependent
> > beans for bean 'org.apache.cxf.resource.ClassLoaderResolver#45a634':
> > [org.apache.cxf.resource.ResourceManager]
> > 11:38:34,174 DEBUG [DefaultListableBeanFactory] Retrieved dependent
> > beans for bean 'org.apache.cxf.resource.ClasspathResolver#518643':
> > [org.apache.cxf.resource.ResourceManager]
> > 11:38:34,175 ERROR [ContextLoader] Context initialization failed
> > org.springframework.beans.factory.BeanCreationException: Error
> > creating bean with name 'helloWorld': Invocation of init method
> > failed; nested exception is java.lang.NullPointerException
> > Caused by:
> > java.lang.NullPointerException
> > at
> >
org.apache.cxf.jaxws.support.JaxWsServiceConfiguration.getInParameterName(JaxWsServiceConfiguration.java:187)
> >
> > at
> >
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getInParameterName(ReflectionServiceFactoryBean.java:1200)
> >
> > at
> >
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getInPartName(ReflectionServiceFactoryBean.java:1180)
> >
> > at
> >
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeParameter(JaxWsServiceFactoryBean.java:390)
> >
> > at
> >
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeClassInfo(JaxWsServiceFactoryBean.java:371)
> >
> > at
> >
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperation(JaxWsServiceFactoryBean.java:187)
> >
> > at
> >
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:303)
> >
> > at
> >
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:196)
> >
> > at
> >
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:195)
> >
> > at
> >
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:246)
> >
> > at
> >
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:136)
> >
> > at
> >
org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractEndpointFactory.java:83)
> >
> > at
> > org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:89)
> >
> > at
> >
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:142)
> >
> > at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:277)
> >
> >
> > 2007/7/10, Willem Jiang <[EMAIL PROTECTED]>:
> >> Hi Christian
> >>
> >> Can you provide the impl class's annotation
> >> (dk.unwire.statistics2.HelloWorldImpl's WebService annotation )? Please
> >> make sure the portName="HelloWorldDev".
> >> It looks like the ReflectionServiceFactoryBean can not find the wsdl
> >> port name from the impl class.
> >>
> >> Cheers,
> >>
> >> Willem.
> >>
> >> Christian Vest Hansen wrote:
> >> > Hi again,
> >> >
> >> > I'm running into this excheption in my quest for a working service.
> >> > I don't know why it somehow can't the port type, or where it's looking
> >> > for a port type.
> >> > I tried renaming the port type in my WSDL and tried to see if I could
> >> > somehow set it with anotations or in my beans.xml, but none of that
> >> > helped any.
> >> > I know that it's reading the WSDL because a syntax error in it would
> >> > prevent it from getting this far.
> >> >
> >> > I'm attaching my beans.xml, wsdl, service interface and service
> >> > implementation in the hopes that it might clue you on what I'm
> >> > apparently doing wrong.
> >> >
> >> > Here's a snip from the log when I deploy my service:
> >> >
> >> > 10:18:32,438 DEBUG [DefaultListableBeanFactory] Creating shared
> >> > instance of singleton bean 'helloWorld'
> >> > 10:18:32,438 DEBUG [DefaultListableBeanFactory] Creating instance of
> >> > bean 'helloWorld' with merged definition [Root bean: class
> >> > [org.apache.cxf.jaxws.EndpointImpl]; scope=singleton; abstract=false;
> >> > lazyInit=false; autowireCandidate=true; autowireMode=0;
> >> > dependencyCheck=0; factoryBeanName=null; factoryMethodName=null;
> >> > initMethodName=publish; destroyMethodName=stop]
> >> > 10:18:32,444 DEBUG [DefaultListableBeanFactory] Returning cached
> >> > instance of singleton bean 'cxf'
> >> > 10:18:32,484 DEBUG [DefaultListableBeanFactory] Eagerly caching bean
> >> > 'helloWorld' to allow for resolving potential circular references
> >> > 10:18:32,494 ERROR [STDERR] Jul 10, 2007 10:18:32 AM
> >> > org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> >> > buildServiceFromWSDL
> >> > INFO: Creating Service {http://ws.unwire.dk/webstat/v1}HelloWorld from
> >> > WSDL: classpath:HelloWorld.wsdl
> >> > 10:18:32,563 DEBUG [DefaultListableBeanFactory] Returning cached
> >> > instance of singleton bean
> >> > 'org.apache.cxf.binding.soap.SoapTransportFactory'
> >> > 10:18:32,575 INFO [DefaultListableBeanFactory] Destroying singletons
> >> > in
> >> >
> >> [EMAIL PROTECTED]:
> >>
> >> >
> >> > defining beans
> >> >
> >>
[cxf,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,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.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,helloWorl
> >>
> >> >
> >> > d];
> >> > root of factory hierarchy
> >> > 10:18:32,579 DEBUG [DefaultListableBeanFactory] Retrieved dependent
> >> > beans for bean
> >> > 'org.apache.cxf.configuration.spring.SpringBeanMap#9a41a5':
> >> > [org.apache.cxf.transport.ConduitInitiatorManager]
> >> > 10:18:32,580 DEBUG [DefaultListableBeanFactory] Retrieved dependent
> >> > beans for bean
> >> > 'org.apache.cxf.configuration.spring.SpringBeanMap#b299f7':
> >> > [org.apache.cxf.transport.DestinationFactoryManager]
> >> > 10:18:32,581 DEBUG [DefaultListableBeanFactory] Retrieved dependent
> >> > beans for bean
> >> > 'org.apache.cxf.configuration.spring.SpringBeanMap#8f95c8':
> >> > [org.apache.cxf.binding.BindingFactoryManager]
> >> > 10:18:32,581 DEBUG [DefaultListableBeanFactory] Retrieved dependent
> >> > beans for bean 'org.apache.cxf.resource.ClassLoaderResolver#da814e':
> >> > [org.apache.cxf.resource.ResourceManager]
> >> > 10:18:32,581 DEBUG [DefaultListableBeanFactory] Retrieved dependent
> >> > beans for bean 'org.apache.cxf.resource.ClasspathResolver#cbc0bc':
> >> > [org.apache.cxf.resource.ResourceManager]
> >> > 10:18:32,581 ERROR [ContextLoader] Context initialization failed
> >> > org.springframework.beans.factory.BeanCreationException: Error
> >> > creating bean with name 'helloWorld': Invocation of init method
> >> > failed; nested exception is
> >> > org.apache.cxf.service.factory.ServiceConstructionException:
> >> > COULD_NOT_FIND_PORTTYPE
> >> > Caused by:
> >> > org.apache.cxf.service.factory.ServiceConstructionException:
> >> > COULD_NOT_FIND_PORTTYPE
> >> > at
> >> >
> >>
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.getInterfaceInfo(ReflectionServiceFactoryBean.java:270)
> >>
> >> >
> >> > at
> >> >
> >>
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeWSDLOperations(ReflectionServiceFactoryBean.java:277)
> >>
> >> >
> >> > at
> >> >
> >>
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.initializeWSDLOperations(JaxWsServiceFactoryBean.java:196)
> >>
> >> >
> >> > at
> >> >
> >>
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:195)
> >>
> >> >
> >> > at
> >> >
> >>
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:246)
> >>
> >> >
> >> > at
> >> >
> >>
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:136)
> >>
> >> >
> >> > at
> >> >
> >>
org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractEndpointFactory.java:83)
> >>
> >> >
> >> > at
> >> >
> >> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:89)
> >>
> >> >
> >> > at
> >> >
> >>
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:142)
> >>
> >> >
> >> > at
> >> org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:277)
> >> > at
> >> org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:223)
> >> > at
> >> org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:175)
> >> > at
> >> org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:329)
> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> > at
> >> >
> >>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>
> >> >
> >> > at
> >> >
> >>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>
> >> >
> >> > at java.lang.reflect.Method.invoke(Method.java:585)
> >> > at
> >> >
> >>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1214)
> >>
> >> >
> >> > at
> >> >
> >>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1179)
> >>
> >> >
> >> > at
> >> >
> >>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1145)
> >>
> >> >
> >> > at
> >> >
> >>
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
> >>
> >> >
> >> > at
> >> >
> >>
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
> >>
> >> >
> >> > at
> >> >
> >>
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:144)
> >>
> >> >
> >> > at
> >> >
> >>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
> >>
> >> >
> >> > at
> >> >
> >>
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
> >>
> >> >
> >> > at
> >> >
> >>
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:279)
> >>
> >> >
> >> > at
> >> >
> >>
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:360)
> >>
> >> >
> >> > at
> >> >
> >>
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:241)
> >>
> >> >
> >> >
> >> >
> >> >
> >> ------------------------------------------------------------------------
> >> >
> >> > <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"
> >> > implementor="dk.unwire.statistics2.HelloWorldImpl"
> >> > address="/HelloWorld"
> >> > wsdlLocation="classpath:HelloWorld.wsdl"
> >> > />
> >> > </beans>
> >> >
> >> ------------------------------------------------------------------------
> >> >
> >> > <?xml version="1.0" encoding="UTF-8"?>
> >> > <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> >> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> >> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> >> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> >> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> >> xmlns:unw="http://ws.unwire.dk/webstat/v1"
> >> xmlns:ns="http://unwire.dk/statistics"
> >> targetNamespace="http://ws.unwire.dk/webstat/v1">
> >> >
> >> > <wsdl:message name="Msg">
> >> > <wsdl:part name="msg" type="xs:string"/>
> >> > </wsdl:message>
> >> > <wsdl:portType name="HelloWorldPort">
> >> > <wsdl:operation name="SayHello">
> >> > <wsdl:input message="unw:Msg"/>
> >> > <wsdl:output message="unw:Msg"/>
> >> > </wsdl:operation>
> >> > </wsdl:portType>
> >> > <wsdl:binding name="HelloWorldSOAP" type="unw:HelloWorldPort">
> >> > <soap:binding style="rpc"
> >> transport="http://schemas.xmlsoap.org/soap/http"/>
> >> > <wsdl:operation name="SayHello">
> >> > <soap:operation
> >> soapAction="http://unwire.dk/SayHello"/>
> >> > <wsdl:input>
> >> > <soap:body use="literal"/>
> >> > </wsdl:input>
> >> > <wsdl:output>
> >> > <soap:body use="literal"/>
> >> > </wsdl:output>
> >> > </wsdl:operation>
> >> > </wsdl:binding>
> >> > <wsdl:service name="HelloWorld">
> >> > <wsdl:port name="HelloWorldDev"
> >> binding="unw:HelloWorldSOAP">
> >> > <soap:address
> >> location="http://localhost:8000/Statistics2/HelloWorld"/>
> >> > </wsdl:port>
> >> > </wsdl:service>
> >> > </wsdl:definitions>
> >> >
> >>
> >>
> >
> >
>
>
--
Venlig hilsen / Kind regards,
Christian Vest Hansen.
--
Venlig hilsen / Kind regards,
Christian Vest Hansen.