Kurt > 1. How do you add services without going through the webservices API, I think that using a JPA filter (or whatever it's called) to insert services directly is probably more hassle that its worth. It will also bypass security checks and validation procedures. I'd consider both of the to be pretty important
On Sun, Apr 28, 2013 at 4:10 PM, Kurt Stam <[email protected]> wrote: > 1. How do you add services without going through the webservices API, > > 2. Sorry I don't know why the listener is causing this error. My advice > would be to start simple with 1 class and learn about the listener. > > --Kurt > > On Apr 28, 2013, at 12:56, Subash Chaturanga <[email protected]> wrote: > > Hi Kurt, > Thanks again for the responses. > JAX-WS interceptor is seems possible. (I didn't do it with the real > scenario, but a PoC without juddi and my environment). > > There can be occasions where people will add services to uddi registry > without going through jax-ws calls. AFAIK we can use java APIs to do so. In > that sense JAX-WS will not work for my case. > > So for JPA intercepting I added an Entiry Listener > annotation(@EntityListeners(MyProjectEntityListener.class) to > org.apache.juddi.model.BusinessEntity class in juddi. And I am getting this. > Any idea why this occurs. > > > org.apache.openjpa.persistence.PersistenceException: > sun.reflect.annotation.TypeNotPresentExceptionProxy > at > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:218) > at > org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156) > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227) > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154) > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60) > at > org.apache.juddi.config.PersistenceManager.getEntityManager(PersistenceManager.java:45) > at > org.apache.juddi.config.AppConfig.getPersistentConfiguration(AppConfig.java:109) > at org.apache.juddi.config.AppConfig.loadConfiguration(AppConfig.java:95) > at org.apache.juddi.config.AppConfig.<init>(AppConfig.java:62) > at org.apache.juddi.config.AppConfig.getInstance(AppConfig.java:183) > at org.apache.juddi.config.AppConfig.getConfiguration(AppConfig.java:205) > at org.apache.juddi.Registry.start(Registry.java:55) > > > > On Thu, Apr 25, 2013 at 10:43 PM, Alex O'Ree <[email protected]> wrote: >> >> I concur, a web service handler aka interceptor is your best bet. > > Hi Alex, > Can you please explain a bit more detail how to achieve this through web > service handler ? >> >> >> On Thu, Apr 25, 2013 at 11:36 AM, Subash Chaturanga <[email protected]> >> wrote: >> > 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" >> >> xmlns:jaxws="http://cxf.apache.org/jaxws" >> >> xmlns:xsi="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"> >> >> >> >> <!-- 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"> >> >> <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 >> > > > > > > -- > Subash Chaturanga > Department of Computer Science & Engineering > University of Moratuwa > Sri Lanka > > Blog - http://subashsdm.blogspot.com/ > Twitter - http://twitter.com/subash89 >
