You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Nikolay Elenkov <ni...@sarion.co.jp> on 2010/04/23 11:09:00 UTC

wrong targetNamespace in generated WSDL

Hello,

I am using apche-cxf 2.2.7, and I can't seem to find a way to set the
target namespace of the WSDL returned by Service?wsdl. It is always
http://www.springframework.org/schema/beans. See below:

<wsdl:definitions name="MyService"
targetNamespace="http://www.springframework.org/schema/beans">
<wsdl:import
location="https://server/myws/services/MyService?wsdl=MyService.wsdl"
namespace="http://my.namespace.com/">
    </wsdl:import>

The  namespace on the wsdl:import is correct, but not the one on
wsdl:definitions is not. I've set the namespace on my implementation class
with @WebService(targetNamespace="..."), but that seems to be ignored.
My service is defined in cxf-servlet.xml, but there seems to be no way
to pass the targetNamespace to <jaxws:endpoint> either. Am I missing something
obvious?

Any hints are much appreciated.


Re: wrong targetNamespace in generated WSDL

Posted by Nikolay Elenkov <ni...@sarion.co.jp>.
On 2010/04/30 10:09, Nikolay Elenkov wrote:
> On 2010/04/29 10:50, Daniel Kulp wrote:
>>
>> Any chance you could create a testcase and log a JIRA?   I'm really not sure 
>> where the other namespace would be coming from.
>>
> 
> Will do, but might take same time.

Done: https://issues.apache.org/jira/browse/CXF-2794


Re: wrong targetNamespace in generated WSDL

Posted by Nikolay Elenkov <ni...@sarion.co.jp>.
On 2010/04/30 10:09, Nikolay Elenkov wrote:
> On 2010/04/29 10:50, Daniel Kulp wrote:
>>
>> Any chance you could create a testcase and log a JIRA?   I'm really not sure 
>> where the other namespace would be coming from.
>>
> 
> Will do, but might take same time. In the mean time, are there any workarounds
> you can think of? I'm thinking of using 'wsdlLocation' to specify a file, but
> will that generate proper <soap:address location/>?
> 

Specifying the wsdlLocation attribute results in the following stack tract, so
no luck there:

org.apache.cxf.service.factory.ServiceConstructionException: Could not find
definition for service {http://www.springframework.org/schema/beans}MyService.
	org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:126)
	org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:415)
	org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:528)
	org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:278)
	org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:178)
	org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)
	org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:105)
	org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:167)
	org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:349)
	org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:262)
	org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:212)
	org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:407)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	java.lang.reflect.Method.invoke(Method.java:597)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1414)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1375)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	java.security.AccessController.doPrivileged(Native Method)
	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
	org.apache.cxf.transport.servlet.CXFServlet.loadAdditionalConfig(CXFServlet.java:171)
	org.apache.cxf.transport.servlet.CXFServlet.updateContext(CXFServlet.java:139)
	org.apache.cxf.transport.servlet.CXFServlet.loadSpringBus(CXFServlet.java:101)
	org.apache.cxf.transport.servlet.CXFServlet.loadBus(CXFServlet.java:70)
	org.apache.cxf.transport.servlet.AbstractCXFServlet.init(AbstractCXFServlet.java:78)
	

Re: wrong targetNamespace in generated WSDL

Posted by Nikolay Elenkov <ni...@sarion.co.jp>.
On 2010/04/29 10:50, Daniel Kulp wrote:
> 
> Any chance you could create a testcase and log a JIRA?   I'm really not sure 
> where the other namespace would be coming from.
> 

Will do, but might take same time. In the mean time, are there any workarounds
you can think of? I'm thinking of using 'wsdlLocation' to specify a file, but
will that generate proper <soap:address location/>?


Re: wrong targetNamespace in generated WSDL

Posted by Daniel Kulp <dk...@apache.org>.
Any chance you could create a testcase and log a JIRA?   I'm really not sure 
where the other namespace would be coming from.

Dan

On Monday 26 April 2010 9:46:37 pm Nikolay Elenkov wrote:
> On 2010/04/24 0:24, Daniel Kulp wrote:
> > On Friday 23 April 2010 5:09:00 am Nikolay Elenkov wrote:
> >> I am using apche-cxf 2.2.7, and I can't seem to find a way to set the
> >> target namespace of the WSDL returned by Service?wsdl. It is always
> >> http://www.springframework.org/schema/beans. See below:
> >> 
> >> <wsdl:definitions name="MyService"
> >> targetNamespace="http://www.springframework.org/schema/beans">
> >> <wsdl:import
> >> location="https://server/myws/services/MyService?wsdl=MyService.wsdl"
> >> namespace="http://my.namespace.com/">
> >> 
> >>     </wsdl:import>
> >> 
> >> The  namespace on the wsdl:import is correct, but not the one on
> >> wsdl:definitions is not. I've set the namespace on my implementation
> >> class with @WebService(targetNamespace="..."), but that seems to be
> >> ignored. My service is defined in cxf-servlet.xml, but there seems to
> >> be no way to pass the targetNamespace to <jaxws:endpoint> either. Am I
> >> missing something obvious?
> >> 
> >> Any hints are much appreciated.
> > 
> > Are you using an aop proxy or similar?   You may need to specify the
> > implementorClass attribute on the jaxws:endpoint so we can get the right
> > class and find the appropriate WebService annotation.
> 
> I'm not using transactions, etc., but Spring may be creating a proxy. At
> any rate, I have specified implementorClass (doesn't work without it) and
> still getting a wrong targetNamespace. Here's my cxf-servlet.xml:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <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:context="http://www.springframework.org/schema/context"
> 	xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
> http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context-2.5.xsd">
> 
> 	<context:annotation-config />
> 
> 	<context:property-placeholder
> location="classpath:myservice-config.properties" />
> 
> 	<bean id="myservice" class="com.namespace.my.MyServiceImpl" />
> 
> 	<jaxws:endpoint id="ws" implementor="#myservice"
> 		serviceName="MyService" 
implementorClass="com.namespace.my.MyServiceImpl"
> 		address="/MyService" publishedEndpointUrl="${publishedEndpointUrl}" 
/>
> 
> </beans>

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: wrong targetNamespace in generated WSDL

Posted by Nikolay Elenkov <ni...@sarion.co.jp>.
On 2010/04/24 0:24, Daniel Kulp wrote:
> On Friday 23 April 2010 5:09:00 am Nikolay Elenkov wrote:
>> I am using apche-cxf 2.2.7, and I can't seem to find a way to set the
>> target namespace of the WSDL returned by Service?wsdl. It is always
>> http://www.springframework.org/schema/beans. See below:
>>
>> <wsdl:definitions name="MyService"
>> targetNamespace="http://www.springframework.org/schema/beans">
>> <wsdl:import
>> location="https://server/myws/services/MyService?wsdl=MyService.wsdl"
>> namespace="http://my.namespace.com/">
>>     </wsdl:import>
>>
>> The  namespace on the wsdl:import is correct, but not the one on
>> wsdl:definitions is not. I've set the namespace on my implementation class
>> with @WebService(targetNamespace="..."), but that seems to be ignored.
>> My service is defined in cxf-servlet.xml, but there seems to be no way
>> to pass the targetNamespace to <jaxws:endpoint> either. Am I missing
>> something obvious?
>>
>> Any hints are much appreciated.
> 
> Are you using an aop proxy or similar?   You may need to specify the 
> implementorClass attribute on the jaxws:endpoint so we can get the right class 
> and find the appropriate WebService annotation.
> 

I'm not using transactions, etc., but Spring may be creating a proxy. At any
rate, I have specified implementorClass (doesn't work without it) and still
getting a wrong targetNamespace. Here's my cxf-servlet.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">

	<context:annotation-config />

	<context:property-placeholder location="classpath:myservice-config.properties" />

	<bean id="myservice" class="com.namespace.my.MyServiceImpl" />

	<jaxws:endpoint id="ws" implementor="#myservice"
		serviceName="MyService" implementorClass="com.namespace.my.MyServiceImpl"
		address="/MyService" publishedEndpointUrl="${publishedEndpointUrl}" />

</beans>


Re: wrong targetNamespace in generated WSDL

Posted by Daniel Kulp <dk...@apache.org>.
On Friday 23 April 2010 5:09:00 am Nikolay Elenkov wrote:
> Hello,
> 
> I am using apche-cxf 2.2.7, and I can't seem to find a way to set the
> target namespace of the WSDL returned by Service?wsdl. It is always
> http://www.springframework.org/schema/beans. See below:
> 
> <wsdl:definitions name="MyService"
> targetNamespace="http://www.springframework.org/schema/beans">
> <wsdl:import
> location="https://server/myws/services/MyService?wsdl=MyService.wsdl"
> namespace="http://my.namespace.com/">
>     </wsdl:import>
> 
> The  namespace on the wsdl:import is correct, but not the one on
> wsdl:definitions is not. I've set the namespace on my implementation class
> with @WebService(targetNamespace="..."), but that seems to be ignored.
> My service is defined in cxf-servlet.xml, but there seems to be no way
> to pass the targetNamespace to <jaxws:endpoint> either. Am I missing
> something obvious?
> 
> Any hints are much appreciated.

Are you using an aop proxy or similar?   You may need to specify the 
implementorClass attribute on the jaxws:endpoint so we can get the right class 
and find the appropriate WebService annotation.


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog