Hi Kurt, Thank you for the detailed description of the solution and links .I will go through this and will update the thread once done. And hopefully once succeeded will definitely add a blog post too, since this is a use case that people might want to achieve.
On Thu, Apr 25, 2013 at 8:58 PM, Kurt T Stam <[email protected]> wrote: > OK I think you are much better of using JAX-WS interceptors then. I > think the JPA layer is too granular for what your needs are. > > 1. To activate, using CXF, add config to the beans.xml in your juddiv3.war: > > http://cxf.apache.org/docs/jax-ws-configuration.html > > Here is a example which shows how to provide interceptors, JAX-WS > handlers, and properties: > > <?xml version="1.0" encoding="UTF-8"?> > <beans xmlns="http://www.springframework.org/schema/beans" > <http://www.springframework.org/schema/beans> > xmlns:jaxws="http://cxf.apache.org/jaxws" <http://cxf.apache.org/jaxws> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > <http://www.w3.org/2001/XMLSchema-instance> > xsi:schemaLocation=" > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://cxf.apache.org/jaxws > http://cxf.apache.org/schemas/jaxws.xsd" > <http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://cxf.apache.org/jaxwshttp://cxf.apache.org/schemas/jaxws.xsd>> > > <!-- Interceptors extend e.g. > org.apache.cxf.phase.AbstractPhaseInterceptor --> > <bean id="anotherInterceptor" class="..." /> > > <!-- Handlers implement e.g. javax.xml.ws.handler.soap.SOAPHandler --> > <bean id="jaxwsHandler" class="..." /> > > <!-- The SOAP client bean --> > <jaxws:client id="helloClient" > serviceClass="demo.spring.HelloWorld" > address="http://localhost:9002/HelloWorld" > <http://localhost:9002/HelloWorld>> > <jaxws:inInterceptors> > <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/> > <ref bean="anotherInterceptor"/> > </jaxws:inInterceptor> > <jaxws:handlers> > <ref bean="jaxwsHandler" /> > </jaxws:handlers> > <jaxws:properties> > <entry key="mtom-enabled" value="true"/> > </jaxws:properties> > </jaxws:client></beans> > > > > http://svn.apache.org/repos/asf/juddi/tags/juddi-3.1.3/juddi-cxf/src/main/webapp/WEB-INF/beans.xml > > 2. I don't think you'd have to change code but in case you do need to set > some annotations, it would be in this class: > > > http://svn.apache.org/repos/asf/juddi/tags/juddi-3.1.3/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIPublicationImpl.java > > 3. Please let us know how that works out for you. It'd be great if you can > add a blog post on our jUDDI Blog about it, and we could add it to our > documentation. > > Cheers, > > --Kurt > > > > > http://cxf.apache.org/docs/jax-ws-configuration.html > > > > On 4/25/13 11:08 AM, Subash Chaturanga wrote: > > > > On Thu, Apr 25, 2013 at 8:20 PM, Kurt T Stam <[email protected]> wrote: > >> On 4/25/13 10:20 AM, Subash Chaturanga wrote: >> >>> Please note: the tricky part is I need to do both my stuff(inserting to >>> uddi registry and inserting to X ) during the particular juddi call. >>> (relevant JAXWS call for service insertion). >>> >>> ** So consider as when adding a service to uddi, my service insertion to >>> X should happen before insertion to uddi registry. Appreciate any one >>> possible solution for me to achieve this. >>> >> > Hi Kurt, > > >> 1. Before you go down the Interceptor path I guess the question is why >> you can't call into system X before calling into jUDDI from your client >> code. >> >> Because it is not actually my client code calling to JUDDI, rather some > system Y . In my case this Y is an ESB (OSB). So "Y" calls to my system's > JUDDI server and inserts to the service to UDDI registry. In the same > service call I want to call X web service. Hence in that sense, I believe > my suggestion of JPA interceptor is correct. > > >> 2. If you really need to call into system X from a JPA interceptor, then >> you should try find an example program demonstrating interceptors to learn >> about how an interceptor works. Are you planning on using hibernate or >> openjpa? > > > In fact, I am using juddi 3.x and it uses openjpa. Why JPA interceptor > needed is because juddi insertions takes place through JPA calls .Those > JAXWS services juddi provides has those JPA calls to do insertions to uddi > data base. It is a bit hard to find proper example for JPA Interceptors in > OpenJPA. That's why I drop a mail to juddi to check whether juddi have a > mechanism to achieve my requirement without going to JPA level. > > > > Maybe you start here: >> http://docs.jboss.org/hibernate/entitymanager/3.5/reference/en/html/listeners.html, >> and look into the @PrePersist annotation ( which I think you can also set >> in the persistence.xml) >> Once you got that to work we can help you with which classes you would >> want to add interceptor to. >> >> 3. If you make a good case for why you need this interception business, >> then we might also be able to add hooks right into the service layer; i.e. >> you'd be able to configure an endpoint and receive a call with the >> serialized XML on every SaveService call. >> >> --Kurt >> >> >> > > > -- > Subash Chaturanga > Department of Computer Science & Engineering > University of Moratuwa > Sri Lanka > > Blog - http://subashsdm.blogspot.com/ > Twitter - http://twitter.com/subash89 > > > > -- Subash Chaturanga Department of Computer Science & Engineering University of Moratuwa Sri Lanka Blog - http://subashsdm.blogspot.com/ Twitter - http://twitter.com/subash89
