You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Fullocto <br...@fr.thalesgroup.com> on 2008/07/11 11:06:08 UTC

Creation of BC provider from a POJO (or a CXFSE component)

Hello;

I would like to crate my Binding component provider endpoints from a pojo
class
What will happen: 
- a webservice registers itself (all of them sends a soap message to a BC
consumer, that sends to the CXFSE), the soap message contains the endpoints
and all webservicse use the same wsdl
- the cxfse or pojo component reads the endpoints string and create the
CXFBC endpoint

By looking at the example (junit test) I wanted to write in my CXFSE
implementation class
in a function createProvider(myEndpoint, receivedLocation) {
CxfBcComponent comp=new CxfBcComponent();
CxfBcProvider ep = new CxfBcProvider();
ep.setWsdl(new ClassPathResource("myCommonWsdl.wsdl"));
ep.setService("urn:mynamespace","myService");
ep.setLocationURL("receivedLocation");
myJbiContainer.activateComponent(comp,"servicemix-cxfbc");

But I don't know how to get the reference of the myJbiContainer and there is
already the servicemix-cxfbc component that is registered, i just need an
activateEndpoint

-- 
View this message in context: http://www.nabble.com/Creation-of-BC-provider-from-a-POJO-%28or-a-CXFSE-component%29-tp18399678p18399678.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Creation of BC provider from a POJO (or a CXFSE component)

Posted by Fullocto <br...@fr.thalesgroup.com>.
It is working now
I added in my CXF-SE xbean.xml:

<classpath>
<component>servicemix-cxf-bc</component>
</classpath>

\o/


-- 
View this message in context: http://www.nabble.com/Creation-of-BC-provider-from-a-POJO-%28or-a-CXFSE-component%29-tp18399678p18506543.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Creation of BC provider from a POJO (or a CXFSE component)

Posted by Fullocto <br...@fr.thalesgroup.com>.
I don't understand what happens during the classloading

As explained previously, I tried to deploy some CXF BC endpoints from a CXF
SE. My service implementation class receives the arguments needed (wsdl,
endpoint location, service name) and creates the BC endpoint.

The first error was the CXFBC class was missing (during deployment of the SU
in servicemix). I had to add the servicemix-cxf-bc**.jar to my service unit
archive and finally I have an error in my class cast (getComponent() !=
cxfbcprovider)

I wanted to have the same classes of CXFBCProvider (load by the same
classloader). I read the jbi.xml file of the 2 CXF components and this
jbi.xml file indicates the component-class-loader-delegation is set to
"parent-first".

So I tried to move the servicemix-cxf-bc**.jar to shared libraries
And the cxfb/cxfbcprovider is now no more found

I previously watched the deployment and I thought the classloader of the
service unit was created from the classloader of the component.

what's wrong Doc?


-- 
View this message in context: http://www.nabble.com/Creation-of-BC-provider-from-a-POJO-%28or-a-CXFSE-component%29-tp18399678p18504020.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Creation of BC provider from a POJO (or a CXFSE component)

Posted by Fullocto <br...@fr.thalesgroup.com>.
Yes, you are right it is CxfBcComponent
I don't succeed in finding the classloader's name...

(I may try to create a POJO instead of running it in my CXF-SE service
implementation class)

-- 
View this message in context: http://www.nabble.com/Creation-of-BC-provider-from-a-POJO-%28or-a-CXFSE-component%29-tp18399678p18459719.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Creation of BC provider from a POJO (or a CXFSE component)

Posted by Freeman Fang <fr...@gmail.com>.
Hi,
Comment inline

Fullocto wrote:
> I have a problem,
> CxfBcComponent comp=null;
> ComponentMBeanImpl=null;
>
> ComponentMBeanImpl= jbiContainer.getComponent("servicemix-cxf-bc")  // got
> it with getContainer() ;) ty
> comp = ComponentMBeanImpl.getComponent();
> comp.addEndpoint(ep);
> but comp is a CxfBcProvider and ComponentMBeanImpl.getComponent() returns a
>   
I guess here you want to say "but comp is a CxfBcComponent", right?
> component 
> If i use Component comp, then I can't use the method addEndpoint
>
> I don't know how to cast, I tried  comp = (CxfBcComponent)
> ComponentMBeanImpl.getComponent();
>   
this cast should work
> (I debug it is a cxfbcprovider!, but it writes an error can't do the classes
> cast)
>   
I guess here you want to say "I debug it is a CxfBcComponent", right?
If the original and dest object you want to cast are both CxfBcComponent 
Object but you still get cast exception, the possible reason is two 
objects are loaded from different classloaders. Would you please check 
the classloader issue of your code?
> but it's not valid..
>
> http://www.nabble.com/file/p18406066/dynamicEndpoint.rtf dynamicEndpoint.rtf 
>
> I found 
> A reply by gnodet: in
> http://cwiki.apache.org/SM/discussion-forums.html#nabble-to10609052%7Ca10610104
>
> You could use dynamic endpoints :-)
> They are resolved dynamically by using
>   DocumentFragement epr = URIResolver.createWSAEPR("ftp://xxx");
>   ServiceEndpoint ep = componentContext.resolveEndpointReference(epr)
> It will create an endpoint dynamically when you send an exchange to this
> ServiceEndpoint. 
>
>
>   


Re: Creation of BC provider from a POJO (or a CXFSE component)

Posted by Fullocto <br...@fr.thalesgroup.com>.
I have a problem,
CxfBcComponent comp=null;
ComponentMBeanImpl=null;

ComponentMBeanImpl= jbiContainer.getComponent("servicemix-cxf-bc")  // got
it with getContainer() ;) ty
comp = ComponentMBeanImpl.getComponent();
comp.addEndpoint(ep);
but comp is a CxfBcProvider and ComponentMBeanImpl.getComponent() returns a
component 
If i use Component comp, then I can't use the method addEndpoint

I don't know how to cast, I tried  comp = (CxfBcComponent)
ComponentMBeanImpl.getComponent();
(I debug it is a cxfbcprovider!, but it writes an error can't do the classes
cast)
but it's not valid..

http://www.nabble.com/file/p18406066/dynamicEndpoint.rtf dynamicEndpoint.rtf 

I found 
A reply by gnodet: in
http://cwiki.apache.org/SM/discussion-forums.html#nabble-to10609052%7Ca10610104

You could use dynamic endpoints :-)
They are resolved dynamically by using
  DocumentFragement epr = URIResolver.createWSAEPR("ftp://xxx");
  ServiceEndpoint ep = componentContext.resolveEndpointReference(epr)
It will create an endpoint dynamically when you send an exchange to this
ServiceEndpoint. 


-- 
View this message in context: http://www.nabble.com/Creation-of-BC-provider-from-a-POJO-%28or-a-CXFSE-component%29-tp18399678p18406066.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Creation of BC provider from a POJO (or a CXFSE component)

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

You mean you want to create cxf bc provider on the fly, that's interesting.

For jbiContainer instance, you can get ComponentContextImpl instance 
(let's say contextImpl )from the CxfSeEndpoint, and just do 
contextImpl.getContainer().

Regards
Freeman

Fullocto wrote:
> Hello;
>
> I would like to crate my Binding component provider endpoints from a pojo
> class
> What will happen: 
> - a webservice registers itself (all of them sends a soap message to a BC
> consumer, that sends to the CXFSE), the soap message contains the endpoints
> and all webservicse use the same wsdl
> - the cxfse or pojo component reads the endpoints string and create the
> CXFBC endpoint
>
> By looking at the example (junit test) I wanted to write in my CXFSE
> implementation class
> in a function createProvider(myEndpoint, receivedLocation) {
> CxfBcComponent comp=new CxfBcComponent();
> CxfBcProvider ep = new CxfBcProvider();
> ep.setWsdl(new ClassPathResource("myCommonWsdl.wsdl"));
> ep.setService("urn:mynamespace","myService");
> ep.setLocationURL("receivedLocation");
> myJbiContainer.activateComponent(comp,"servicemix-cxfbc");
>
> But I don't know how to get the reference of the myJbiContainer and there is
> already the servicemix-cxfbc component that is registered, i just need an
> activateEndpoint
>
>