You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Thushara Seneviratne <th...@gmail.com> on 2010/02/22 11:16:10 UTC
CXF-SE - how define targetNamespace without annotations
Hi ,
We have a specific requirement to change service's "targetNamespace" during
the run time only using configuration. if we use @WebService annotation ,
either we have to recompile the code or need to do some byte code processing
in order to change the "targetNamespace" value, it would be nice if we can
provide the "targetNamespace" in the xbean.xml or any other configuration
file , any one have any idea about how to do this with SMX ?
@WebService(name = "SimpleService", targetNamespace = "
http://my.simple.org/CoC1/")
Thanks,
Thushara
Re: CXF-SE - how define targetNamespace without annotations
Posted by Thushara Seneviratne <th...@gmail.com>.
HI Mario,
According to our requirements we have to deploy same service several times
and we need a way to identify each of this service separately that why we
try to have different namespace for each service instance. Once we want to
add a new service instance we need to change the namespace and deploy the
service unit again.
Thanks,
Thushara
On Mon, Feb 22, 2010 at 4:12 PM, Mariusz Brylant <mb...@gmail.com> wrote:
> Hi Thushara,
>
> Just curious., why do you need to change the namespace of the service
> during runtime? Would not that be sort of confusing for the clients
> consuming your service?
>
> /Mario
>
>
> Thushara Seneviratne wrote:
>
>> Hi ,
>>
>> We have a specific requirement to change service's "targetNamespace"
>> during
>> the run time only using configuration. if we use @WebService annotation ,
>> either we have to recompile the code or need to do some byte code
>> processing
>> in order to change the "targetNamespace" value, it would be nice if we can
>> provide the "targetNamespace" in the xbean.xml or any other configuration
>> file , any one have any idea about how to do this with SMX ?
>>
>>
>> @WebService(name = "SimpleService", targetNamespace = "
>> http://my.simple.org/CoC1/")
>>
>>
>> Thanks,
>>
>> Thushara
>>
>>
>>
>
Re: CXF-SE - how define targetNamespace without annotations
Posted by Mariusz Brylant <mb...@gmail.com>.
Hi Thushara,
Just curious., why do you need to change the namespace of the service
during runtime? Would not that be sort of confusing for the clients
consuming your service?
/Mario
Thushara Seneviratne wrote:
> Hi ,
>
> We have a specific requirement to change service's "targetNamespace" during
> the run time only using configuration. if we use @WebService annotation ,
> either we have to recompile the code or need to do some byte code processing
> in order to change the "targetNamespace" value, it would be nice if we can
> provide the "targetNamespace" in the xbean.xml or any other configuration
> file , any one have any idea about how to do this with SMX ?
>
>
> @WebService(name = "SimpleService", targetNamespace = "
> http://my.simple.org/CoC1/")
>
>
> Thanks,
>
> Thushara
>
>
Re: CXF-SE - how define targetNamespace without annotations
Posted by Thushara Seneviratne <th...@gmail.com>.
Hi ,
This approach using service="QName" work perfectly for routing but i got
problem when I deploy the second service unit ( here second one means the
same service unit with different service name attribute)
when I deploy first service i can see the following log
INFO - WSDL1Processor - Endpoint ServiceEndpoint[service={
http://opensource.esb.org/CoA/}SimpleService,endpoint=SimpleServicePort] has
a service description, but no matching service found in [{
http://opensource.esb.org/CoC/}SimpleService]
even in the JMXConsole I can see a endpoint with a name {
http://opensource.esb.org/CoA/}SimpleService
But when I deploy second service unit ( same service unit only service
attribute of the xbean.xml is different) I got following exception
Caused by: java.io.IOException: JBIDestination for Endpoint {
http://opensource.esb.org/CoC/}SimpleService{http://opensource.esb.org/CoC/}SimpleServicehas
already been created
at
org.apache.cxf.transport.jbi.JBITransportFactory.getDestination(JBITransportFactory.java:138)
at
org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:106)
any idea ?
Thanks,
Thushara
2010/2/23 Thushara Seneviratne <th...@gmail.com>
> Hi Freeman,
>
> On Tue, Feb 23, 2010 at 12:44 PM, Freeman Fang <fr...@gmail.com>wrote:
>
>> Hi,
>>
>> My comment inline
>>
>> On 2010-2-23, at 下午2:30, Thushara Seneviratne wrote:
>>
>> Hi Freeman,
>>>
>>> Thanks for your valuable hint I tried for that on several versions,
>>> including 2009.02 but still I cant change service name using "service"
>>>
>> Could you explain how you use 2009.02 version?
>>
>
> hammmm this is the place I went wrong , I only modified Maven dependency
> of my service unit but after your comment I download and deploy the 2009.02
> version of CXF-SE and now everything work fine. Thanks a lot for your help !
>
> Thanks,
>
> Thushara
>
>
>
>>
>> attribute on CXF-SE endpoint. This is what i tried
>>>
>>> In my xbean.xml i have following settings
>>>
>>> <cxfse:endpoint service="cod:SimpleService">
>>> <cxfse:pojo>
>>> <bean class="simple.SimpleService" />
>>> </cxfse:pojo>
>>> </cxfse:endpoint>
>>>
>>> Here prefix "cod" refers to a new namespace
>>>
>> What's the cod is ?
>>
>>
>>> 1.) I used above xbean file with following annotation with values
>>>
>>> @WebService(name = "SimpleService", targetNamespace = "
>>> http://opensource.esb.org/CoC/")
>>>
>>> now service name was {http://opensource.esb.org/CoC/}SimpleService ,
>>>
>> How you get the service name? Is the service name used for JBI endpoint,
>> which you can specified as targetService for your consumer endpoint?
>>
>> Freeman
>>
>> that what i mention in annotation not the value mention in endpoint.
>>>
>>>
>>> 2.) used xbean file with annotation without values
>>>
>>> @WebService
>>>
>>> now service name was {packageName}SimpleService , again endpoint
>>> "service" attribute value was not taken as service name
>>>
>>>
>>> I'm not sure i have missed something here ?
>>>
>>> Thanks,
>>>
>>> Thushara
>>>
>>> On Mon, Feb 22, 2010 at 4:25 PM, Freeman Fang <freeman.fang@gmail.com
>>> >wrote:
>>>
>>> Hi,
>>>>
>>>> As we can specify service name(which is a QName) for cxf se endpoint,
>>>> so I
>>>> believe you can specify your targetNamespace in xbean.xml.
>>>> Just add
>>>>
>>>> service attribute for your cxf se endpoint should be ok.
>>>>
>>>> Something like
>>>>
>>>> service="your_prefix:SimpleService"
>>>>
>>>> and add your_prefix declaration (xmlns:your_prefix="
>>>> http://my.simple.org/CoC1/") for your xbean.xml.
>>>>
>>>> You need use servicemix-cxf-se 2009.02 or later version.
>>>>
>>>> Freeman
>>>>
>>>> On 2010-2-22, at 下午6:16, Thushara Seneviratne wrote:
>>>>
>>>> Hi ,
>>>>
>>>>>
>>>>> We have a specific requirement to change service's "targetNamespace"
>>>>> during
>>>>> the run time only using configuration. if we use @WebService annotation
>>>>> ,
>>>>> either we have to recompile the code or need to do some byte code
>>>>> processing
>>>>> in order to change the "targetNamespace" value, it would be nice if we
>>>>> can
>>>>> provide the "targetNamespace" in the xbean.xml or any other
>>>>> configuration
>>>>> file , any one have any idea about how to do this with SMX ?
>>>>>
>>>>>
>>>>> @WebService(name = "SimpleService", targetNamespace = "
>>>>> http://my.simple.org/CoC1/")
>>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Thushara
>>>>>
>>>>>
>>>>
>>>> --
>>>> Freeman Fang
>>>> ------------------------
>>>> Open Source SOA: http://fusesource.com
>>>>
>>>>
>>>>
>>
>> --
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>
>
Re: CXF-SE - how define targetNamespace without annotations
Posted by Thushara Seneviratne <th...@gmail.com>.
Hi Freeman,
On Tue, Feb 23, 2010 at 12:44 PM, Freeman Fang <fr...@gmail.com>wrote:
> Hi,
> My comment inline
>
> On 2010-2-23, at 下午2:30, Thushara Seneviratne wrote:
>
> Hi Freeman,
>>
>> Thanks for your valuable hint I tried for that on several versions,
>> including 2009.02 but still I cant change service name using "service"
>>
> Could you explain how you use 2009.02 version?
hammmm this is the place I went wrong , I only modified Maven dependency of
my service unit but after your comment I download and deploy the 2009.02
version of CXF-SE and now everything work fine. Thanks a lot for your help !
Thanks,
Thushara
>
> attribute on CXF-SE endpoint. This is what i tried
>>
>> In my xbean.xml i have following settings
>>
>> <cxfse:endpoint service="cod:SimpleService">
>> <cxfse:pojo>
>> <bean class="simple.SimpleService" />
>> </cxfse:pojo>
>> </cxfse:endpoint>
>>
>> Here prefix "cod" refers to a new namespace
>>
> What's the cod is ?
>
>
>> 1.) I used above xbean file with following annotation with values
>>
>> @WebService(name = "SimpleService", targetNamespace = "
>> http://opensource.esb.org/CoC/")
>>
>> now service name was {http://opensource.esb.org/CoC/}SimpleService ,
>>
> How you get the service name? Is the service name used for JBI endpoint,
> which you can specified as targetService for your consumer endpoint?
>
> Freeman
>
> that what i mention in annotation not the value mention in endpoint.
>>
>>
>> 2.) used xbean file with annotation without values
>>
>> @WebService
>>
>> now service name was {packageName}SimpleService , again endpoint
>> "service" attribute value was not taken as service name
>>
>>
>> I'm not sure i have missed something here ?
>>
>> Thanks,
>>
>> Thushara
>>
>> On Mon, Feb 22, 2010 at 4:25 PM, Freeman Fang <freeman.fang@gmail.com
>> >wrote:
>>
>> Hi,
>>>
>>> As we can specify service name(which is a QName) for cxf se endpoint, so
>>> I
>>> believe you can specify your targetNamespace in xbean.xml.
>>> Just add
>>>
>>> service attribute for your cxf se endpoint should be ok.
>>>
>>> Something like
>>>
>>> service="your_prefix:SimpleService"
>>>
>>> and add your_prefix declaration (xmlns:your_prefix="
>>> http://my.simple.org/CoC1/") for your xbean.xml.
>>>
>>> You need use servicemix-cxf-se 2009.02 or later version.
>>>
>>> Freeman
>>>
>>> On 2010-2-22, at 下午6:16, Thushara Seneviratne wrote:
>>>
>>> Hi ,
>>>
>>>>
>>>> We have a specific requirement to change service's "targetNamespace"
>>>> during
>>>> the run time only using configuration. if we use @WebService annotation
>>>> ,
>>>> either we have to recompile the code or need to do some byte code
>>>> processing
>>>> in order to change the "targetNamespace" value, it would be nice if we
>>>> can
>>>> provide the "targetNamespace" in the xbean.xml or any other
>>>> configuration
>>>> file , any one have any idea about how to do this with SMX ?
>>>>
>>>>
>>>> @WebService(name = "SimpleService", targetNamespace = "
>>>> http://my.simple.org/CoC1/")
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Thushara
>>>>
>>>>
>>>
>>> --
>>> Freeman Fang
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>>
>>>
>>>
>
> --
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
>
>
Re: CXF-SE - how define targetNamespace without annotations
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
My comment inline
On 2010-2-23, at 下午2:30, Thushara Seneviratne wrote:
> Hi Freeman,
>
> Thanks for your valuable hint I tried for that on several versions,
> including 2009.02 but still I cant change service name using "service"
Could you explain how you use 2009.02 version?
> attribute on CXF-SE endpoint. This is what i tried
>
> In my xbean.xml i have following settings
>
> <cxfse:endpoint service="cod:SimpleService">
> <cxfse:pojo>
> <bean class="simple.SimpleService" />
> </cxfse:pojo>
> </cxfse:endpoint>
>
> Here prefix "cod" refers to a new namespace
What's the cod is ?
>
> 1.) I used above xbean file with following annotation with values
>
> @WebService(name = "SimpleService", targetNamespace = "
> http://opensource.esb.org/CoC/")
>
> now service name was {http://opensource.esb.org/
> CoC/}SimpleService ,
How you get the service name? Is the service name used for JBI
endpoint, which you can specified as targetService for your consumer
endpoint?
Freeman
> that what i mention in annotation not the value mention in endpoint.
>
>
> 2.) used xbean file with annotation without values
>
> @WebService
>
> now service name was {packageName}SimpleService , again endpoint
> "service" attribute value was not taken as service name
>
>
> I'm not sure i have missed something here ?
>
> Thanks,
>
> Thushara
>
> On Mon, Feb 22, 2010 at 4:25 PM, Freeman Fang
> <fr...@gmail.com>wrote:
>
>> Hi,
>>
>> As we can specify service name(which is a QName) for cxf se
>> endpoint, so I
>> believe you can specify your targetNamespace in xbean.xml.
>> Just add
>>
>> service attribute for your cxf se endpoint should be ok.
>>
>> Something like
>>
>> service="your_prefix:SimpleService"
>>
>> and add your_prefix declaration (xmlns:your_prefix="
>> http://my.simple.org/CoC1/") for your xbean.xml.
>>
>> You need use servicemix-cxf-se 2009.02 or later version.
>>
>> Freeman
>>
>> On 2010-2-22, at 下午6:16, Thushara Seneviratne wrote:
>>
>> Hi ,
>>>
>>> We have a specific requirement to change service's "targetNamespace"
>>> during
>>> the run time only using configuration. if we use @WebService
>>> annotation ,
>>> either we have to recompile the code or need to do some byte code
>>> processing
>>> in order to change the "targetNamespace" value, it would be nice
>>> if we can
>>> provide the "targetNamespace" in the xbean.xml or any other
>>> configuration
>>> file , any one have any idea about how to do this with SMX ?
>>>
>>>
>>> @WebService(name = "SimpleService", targetNamespace = "
>>> http://my.simple.org/CoC1/")
>>>
>>>
>>> Thanks,
>>>
>>> Thushara
>>>
>>
>>
>> --
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>
--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com
Re: CXF-SE - how define targetNamespace without annotations
Posted by Thushara Seneviratne <th...@gmail.com>.
Hi Freeman,
Thanks for your valuable hint I tried for that on several versions,
including 2009.02 but still I cant change service name using "service"
attribute on CXF-SE endpoint. This is what i tried
In my xbean.xml i have following settings
<cxfse:endpoint service="cod:SimpleService">
<cxfse:pojo>
<bean class="simple.SimpleService" />
</cxfse:pojo>
</cxfse:endpoint>
Here prefix "cod" refers to a new namespace
1.) I used above xbean file with following annotation with values
@WebService(name = "SimpleService", targetNamespace = "
http://opensource.esb.org/CoC/")
now service name was {http://opensource.esb.org/CoC/}SimpleService ,
that what i mention in annotation not the value mention in endpoint.
2.) used xbean file with annotation without values
@WebService
now service name was {packageName}SimpleService , again endpoint
"service" attribute value was not taken as service name
I'm not sure i have missed something here ?
Thanks,
Thushara
On Mon, Feb 22, 2010 at 4:25 PM, Freeman Fang <fr...@gmail.com>wrote:
> Hi,
>
> As we can specify service name(which is a QName) for cxf se endpoint, so I
> believe you can specify your targetNamespace in xbean.xml.
> Just add
>
> service attribute for your cxf se endpoint should be ok.
>
> Something like
>
> service="your_prefix:SimpleService"
>
> and add your_prefix declaration (xmlns:your_prefix="
> http://my.simple.org/CoC1/") for your xbean.xml.
>
> You need use servicemix-cxf-se 2009.02 or later version.
>
> Freeman
>
> On 2010-2-22, at 下午6:16, Thushara Seneviratne wrote:
>
> Hi ,
>>
>> We have a specific requirement to change service's "targetNamespace"
>> during
>> the run time only using configuration. if we use @WebService annotation ,
>> either we have to recompile the code or need to do some byte code
>> processing
>> in order to change the "targetNamespace" value, it would be nice if we can
>> provide the "targetNamespace" in the xbean.xml or any other configuration
>> file , any one have any idea about how to do this with SMX ?
>>
>>
>> @WebService(name = "SimpleService", targetNamespace = "
>> http://my.simple.org/CoC1/")
>>
>>
>> Thanks,
>>
>> Thushara
>>
>
>
> --
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
>
>
Re: CXF-SE - how define targetNamespace without annotations
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
As we can specify service name(which is a QName) for cxf se endpoint,
so I believe you can specify your targetNamespace in xbean.xml.
Just add
service attribute for your cxf se endpoint should be ok.
Something like
service="your_prefix:SimpleService"
and add your_prefix declaration (xmlns:your_prefix="http://my.simple.org/CoC1/
") for your xbean.xml.
You need use servicemix-cxf-se 2009.02 or later version.
Freeman
On 2010-2-22, at 下午6:16, Thushara Seneviratne wrote:
> Hi ,
>
> We have a specific requirement to change service's "targetNamespace"
> during
> the run time only using configuration. if we use @WebService
> annotation ,
> either we have to recompile the code or need to do some byte code
> processing
> in order to change the "targetNamespace" value, it would be nice if
> we can
> provide the "targetNamespace" in the xbean.xml or any other
> configuration
> file , any one have any idea about how to do this with SMX ?
>
>
> @WebService(name = "SimpleService", targetNamespace = "
> http://my.simple.org/CoC1/")
>
>
> Thanks,
>
> Thushara
--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com