Conclusion just in case somebody else will hit same problem:

I debugged the JAXB2 project and by doing the schema first approach I
discovered that artifacts are the same as previously in the wsdl first
scenario; what happened is that the generated template
for the services.xml using the top-down toolkit from MyEclipse was not
correct! So I created my own services.xml instead to modify the template
created by MyEclipse and now the generated schema is absolutely correct
in my opinion. No need for that workaround.

Beside I talked with Matthew Graham, the person who added the
service.setWSDLWriter(new ResourceWSDL("myService.wsdl"));
to the manual on 30 April, and he implemented this:
>>             // Create an XFire Service
>>             XmlBeansServiceFactory factory = new
>> XmlBeansServiceFactory();
>>             Service service =
>> factory.create(MyServiceImpl.class);
>>            
>>
>>     
> service.setProperty(XmlBeansType.XMLBEANS_NAMESPACE_HACK,
>   
>> "true");
>>             // Add WSDLWriter to load WSDL
>>             service.setWSDLWriter(new
>> ResourceWSDL("myservice.wsdl"));
>>             // Register the service in the
>> ServiceRegistry
>>             XFire xfire =
>> XFireFactory.newInstance().getXFire();
>>            
>> xfire.getServiceRegistry().register(service);
all on the server side and not in the ServiceImpl 
implementation class, but a higher level server class (using embedded 
Jetty). He used XMLBeans, Maven2, Jetty and wsgen plugin to generate stub code.
So that is fine because it respects the "must setup wsdlwriter after service is 
created".

There were no feedback from any person using a spring bean and intermix spring 
syntax with xfire syntax 
to implement this task...

Anyway creating from scratch your services.xml will get rid of the wrong schema 
in the dynamically generated wsdl.

JAXB2 in XFire is O.K. :-)

That's all.




On Wed, 2007-16-05 at 20:55 -0400, Dragos Pavel wrote:
> Hi All,
> 
> I just discovered (yes, read again the manual...) that to implement this
> workaround I have to intermix the Spring and XFire syntax by using the
> XBean ( because we cannot use spring deployment descriptor tags in the
> services.xml if we don't use XBean ; the regular services.xml config
> file is NOT a Spring deployment descriptor, it is Xfire deployment
> descriptor ; that's why I was not able to retrieve the xfire objects
> from the spring context the way I was trying before ). 
> 
> Here is a link for a must read:
> http://xfire.codehaus.org/Spring%2C+XBean%2C+Servlets+and+more
> 
> Now how is the right way to configure - to be able to use both syntaxes
> please (spring and xfire) ? I was trying something similar with the
> manual page but was not successful.
> 
> This is one of the many versions of the spring bean implementation that
> I tried :
> -----------------------------------------------------------------
> public class OriginalBeanImpl implements OriginalBean
> {
>     // using original wsdl 
>     public String resetWSDL(String originalWSDL)
>     {     
>         ClassPathXmlApplicationContext context = 
>             new ClassPathXmlApplicationContext(new String[] {
>                 "META-INF/xfire/services.xml", 
>                 "/org/codehaus/xfire/spring/xfire.xml" });      
>         
>         // get registry from the XFire instance
>         //ServiceRegistry serviceRegistry = xfire.getServiceRegistry();
> 
>         //ddd - workaround for the wsdl:
>         org.codehaus.xfire.service.Service service =
> serviceRegistry.getService("Service"); 
>         
>         System.out.println("checking the Service we get from
> ServiceRegistry = " + service.getTargetNamespace());
>    
>         try
>         {
>             File _originalWSDL = new File(originalWSDL);
>             service.setWSDLWriter(new ResourceWSDL(_originalWSDL.toURL
> ()));           
>             System.out.println
> ("----------------"+_originalWSDL.getAbsolutePath
> ()+"-----------------");
>             System.out.println("----------------"+_originalWSDL.toURL
> ().toString()+"-----------------");
>         }
>         catch (MalformedURLException e)
>         {
>             e.printStackTrace();
>         }         
> 
>         
>         return originalWSDL;
>     }
>    
> }
> -----------------------------------------------------------------
> 
> And here is the way I referenced it in the services.xml file trying to
> do something similar to what was described in the manual page:
> -----------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://xfire.codehaus.org/config/1.0";>
>       <xfire>
>           <inHandlers>
>               <handler handlerClass="org.codehaus.xfire.util.dom.DOMInHandler
> "/>
>               <handler
> handlerClass="org.codehaus.xfire.util.LoggingHandler"/>
>           </inHandlers>                           
>           <outHandlers>
>               <handler
> handlerClass="org.codehaus.xfire.util.dom.DOMOutHandler "/>
>               <handler
> handlerClass="org.codehaus.xfire.util.LoggingHandler"/>
>           </outHandlers>          
>           <faultHandlers>             
>               <handler
> handlerClass="org.codehaus.xfire.util.dom.DOMOutHandler "/>
>             <handler
> handlerClass="org.codehaus.xfire.util.LoggingHandler"/>
>           </faultHandlers>
>     </xfire>
>       <service>
>               <inHandlers>
>                       <handler
>                               
> handlerClass="org.codehaus.xfire.util.dom.DOMInHandler " />
>                       <handler
>                               
> handlerClass="org.codehaus.xfire.util.LoggingHandler" />
>               </inHandlers>
>               <outHandlers>
>                       <handler
>                               
> handlerClass="org.codehaus.xfire.util.dom.DOMOutHandler " />
>                       <handler
>                               
> handlerClass="org.codehaus.xfire.util.LoggingHandler" />
>               </outHandlers>
>               <faultHandlers>
>                       <handler
>                               
> handlerClass="org.codehaus.xfire.util.dom.DOMOutHandler " />
>                       <handler
>                               
> handlerClass="org.codehaus.xfire.util.LoggingHandler" />
>               </faultHandlers>
>               <name>Service</name>
>               <namespace>http....
>               </namespace>
> <serviceClass>package.ServiceImpl</serviceClass>                              
>                                 
>               <serviceFactory>
>                       org.codehaus.xfire.jaxb2.JaxbServiceFactory
>               </serviceFactory>    
>               <style>document</style>
>               <use>literal</use>
>               <scope>application</scope>      
>       </service>      
>       
>       <service>
>         <name>OriginalBean</name>
>         <serviceBean>#originalBean</serviceBean>
>       </service>
> 
>       <bean id="originalBean" class="spring.OriginalBean">
>           <property
> name="originalWSDL"><value>"/usr/local/..../sunday.war/WEB-
> INF/wsdl/Service.wsdl"</value></property>              
>       </bean>  
>           
> </beans>
> -----------------------------------------------------------------
> 
> Do I have to use this ?
>       <bean id="xfire.serviceRegistry"
>               class="org.codehaus.xfire.service.DefaultServiceRegistry"
>               singleton="true" />
> 
> 
> Obviously I need help configuring the services.xml to be able to use
> both syntaxes... and get a hold of "xfire.serviceRegistry" bean in the
> right way ... Maybe we can add more to the manual page to be more
> coherent... 
> 
> Where the xfire.xml has to be located in order to be found correctly ?
> 
> 
> I get this exception now:
> org.springframework.beans.factory.BeanDefinitionStoreException: Error
> registering bean with name '' defined in class path resource [META-
> INF/xfire/services.xml]: Bean class [value] not found; nested exception
> is java.lang.ClassNotFoundException: value
> java.lang.ClassNotFoundException: value
>       at org.apache.catalina.loader.WebappClassLoader.loadClass
> (WebappClassLoader.java:1355)
>       at org.apache.catalina.loader.WebappClassLoader.loadClass
> (WebappClassLoader.java:1201)
>       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> 
> Signed,
> DesperadoTwo
> 
> 
> 
> On Wed, 2007-16-05 at 09:45 -0400, Dragos Pavel wrote: 
> > 1) I suppose that JAXB2 are responsible to create the schema in the
> > generated wsdl (correct me if I'm wrong) so in this case there are
> > obvious issues if one is trying to create web services using JAXB2 (well
> > it worked for the clients, but not for publishing your own web services
> > because of the wrong generated schema) but not using Spring + Xfire to
> > develop those services.
> > 
> > 2) It looks like services.xml is corrupted, because this error message
> > that I get is not meaningful. There is no bean name in it actually and
> > the ref is interpreted as a class specification and not as the tag
> > name !!!
> > 
> > Or the communication between jboss, apache springframework and
> > codehaus.xfire classes is not good and the meaning of
> > information retrieved from .xml files is misinterpreted during the
> > processing of services.xml config file, which is causing this weird
> > error !!!
> > 
> > Bottom-line I can not retrieve the xfire objects ( the xfire or the
> > serviceRegistry beans ) from the spring context ( = services.xml file ).
> > 
> > 
> > 
> > On Tue, 2007-15-05 at 20:44 -0400, Dragos Pavel wrote:
> > > Using JAXB2 and XFire only ( NOT Spring + Xfire ):
> > > 
> > > 1) Using JAXB2 bindings on the service side - is JAXB2
> > > responsible for generating the schema parts in the wsdl, or is
> > >     wsdl4j?
> > > 
> > > 2) I already read all the related threads and the short description in
> > > the manual introduced by a user at the end of April. 
> > > 
> > > If WSDL is a problem, then one can replace it with original. So your
> > > WSDL from file system will be used instead of generated one. I wrote
> > > simple spring bean which will use serviceRegistry ( defined in
> > > xfire.xml ). That's fine, the problem comes when I try to retrieve
> > > the serviceRegistry from spring context defined in services.xml like
> > > this:
> > > 
> > >   <bean id="xfire.serviceRegistry"
> > > class="org.codehaus.xfire.service.DefaultServiceRegistry"
> > > singleton="true"/>
> > >   </bean>
> > >     <bean id="originalBean" class="spring.OriginalBean">
> > >         <property name="DefaultServiceRegistry"><ref
> > > bean="xfire.serviceRegistry"/></property>
> > >         <property name="originalWSDL"><value>"/usr/local/.../WEB-
> > > INF/wsdl/Service.wsdl"</value></property>              
> > >     </bean> 
> > > 
> > > I tried other configuration with no success, I always get this error:
> > > 20:13:21,224 ERROR [XFireServlet] Error initializing XFireServlet.
> > > org.springframework.beans.factory.BeanDefinitionStoreException: Error
> > > registering bean with name '' defined in class path resource [META-
> > > INF/xfire/services.xml]: Bean class [ref] not found; nested exception is
> > > java.lang.ClassNotFoundException: ref
> > > java.lang.ClassNotFoundException: ref
> > >   at org.apache.catalina.loader.WebappClassLoader.loadClass
> > > (WebappClassLoader.java:1355)
> > >   at org.apache.catalina.loader.WebappClassLoader.loadClass
> > > (WebappClassLoader.java:1201)
> > >   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> > >   at java.lang.Class.forName0(Native Method)
> > >   at java.lang.Class.forName(Class.java:242)
> > >   at org.springframework.util.ClassUtils.forName(ClassUtils.java:108)
> > >   at
> > > org.springframework.beans.factory.support.BeanDefinitionReaderUtils.createBeanDefinition(BeanDefinitionReaderUtils.java:65)
> > >   at
> > > org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitionElement(DefaultXmlBeanDefinitionParser.java:426)
> > > 
> > > My bean is correct and in the right package, the id of the bean is
> > > correct referenced so it's only the fact that it can not find the xfire
> > > or serviceRegistry bean from the context.
> > > 
> > > I must setup wsdlwriter after service is created.
> > > 
> > > It was suggested:
> > > " Check xfire.xml file ( it automaticaly included in services.xml ),
> > > there are defined all important xfire objects, so you can retrive them
> > > from spring context. "
> > > 
> > > That's the problem, I can not retrieve the xfire objects from the spring
> > > context...
> > > 
> > > Any suggestions ?
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe from this list please visit:
> > > 
> > >     http://xircles.codehaus.org/manage_email
> > > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> > 
> >     http://xircles.codehaus.org/manage_email
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to