cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sbery...@progress.com>
Subject Re: CXF, osgi and tomcat problem
Date Wed, 20 Jan 2010 16:43:57 GMT
Hi

>
> Hello Sergey,
>
> Thank you very much for response.
>
> I am using SoapUI-3.0.1 for generating the client stubs. I am generating
> client stubs for restful web services using DOSGI. I found that, with DOSGI
> grammer tag is empty in wadl.

The grammar section will only be generated if the response or request types are JAXB-annotated
classes. The WADLGenerator can now be 
configured from Spring/programmatically so perhaps I can update it to accept the external
schema references, though that schema will 
have to be loaded internally anyway to ensure WADL request/response representations can link
to corresponding schema element 
definitions - can be a bit tricky but should work.
Given that JAXB annotations have to be visible, you need to update the osgi bundle to import
jaxb packages...


>
> I tried to use tomcat for deployment and write below code:
>
> ServletTransportFactory sp = new ServletTransportFactory(bus);
>        JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>        sf.setDestinationFactory(sp) ;
>        sf.setAddress("/book");
> //       sf.setAddress("http://localhost:6767/");
>
> When I run it on address "http://localhost:6767/" (running on jetty), it
> works very fine. But when I create my own destination factory, I get log
> message ("INFO: Setting the server's publish address to /book"). Now if I
> try to use this address, (Http://localhost:8080/myproject/book) on browser,
> I get 404 error.
>
> I feel, I am missing some property in my destination factory. Can any body
> help me in this regards?

How is "myproject" context is registered ? I thought you'd need to use the code similar to
the one posted in the previous message 
(see below...)

cheers, Sergey

>
> Thank you in advance.
>
>
> Sergey Beryozkin-2 wrote:
>>
>> Hi
>>
>>>
>>> Hello,
>>>
>>> I am newbie for CXF. I am using CXF, osgi (equinox), tomcat configuration
>>> for testing. My motto to expose restful web services with tomcat in osgi
>>> enviroment.
>>>
>>> I succeeded in exposing CXF in tomcat without OSGI. For this I forwarded
>>> all
>>> the request to CXFServlet with some of spring configuration.
>>>
>> <snip/>
>>
>>>
>>> Now I try to use tomcat and osgi environement. I am using
>>> servletbrigge.jar
>>> for tomcat configuration.
>>>
>>> My understanding is... request should come to websevice should first
>>> redirect to servlet bridge. From here it should go to CXFServlet.
>>>
>>> Now I should expose any endpoint, This endpoint will be called by
>>> CXFServlet
>>> without jetty and with tomcat.
>>>
>>> Now my problem is: I read the CXF document and how to publish endpoint.
>>> for
>>> this I am using code snippet:
>>>
>>> JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
>>> sf.setResourceClasses(CustomerService.class);
>>> sf.setResourceProvider(CustomerService.class, new
>>> SingletonResourceProvider(new CustomerService()));
>>> sf.setAddress("http://localhost:9000/");
>>> sf.create();
>>>
>>> When I give the address "http://localhost:9000", it is invoking jetty.
>>> how
>>> to avoid jetty invocation and use tomcat configuration?
>>>
>>> Is it possible to solve this by any configuration, please advice me or
>>> any
>>> code snippet will help me a lot.
>>
>> Have a look please here :
>> http://svn.apache.org/repos/asf/cxf/dosgi/tags/cxf-dosgi-ri-1.1/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/JaxRSHttpServiceConfigurationTypeHandler.java
>>
>> check createServer(...), you probably will need to do something similar,
>> in the simplest case :
>>
>> CXFNonSpringServlet cxf = new CXFNonSpringServlet();
>> HttpService httpService = getHttpService();
>> httpService.registerServlet(contextRoot, cxf, new Hashtable<String,
>> String>(), null);
>> Bus bus = cxf.getBus();
>>
>> JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
>> factory.setBus(bus);
>> factory.setServiceClass(iClass);
>> factory.setResourceProvider(iClass, new
>> SingletonResourceProvider(serviceBean));
>> factory.setAddress("/");
>> // get custom providers (if any) and register them
>> // factory.setProviders(providers);
>> factory.create();>
>>> Another problem: I also tried it with DOSGI. The problem with DOSGI is, I
>>> can't get Grammer tag and not able to generate stubs. If any body can
>>> suggest me how to overcome both the problem for DOSGI, I can take this
>>> solution and start working on this.
>>
>> Can you explain a bit more ? Which stubs ?
>>
>> cheers, Sergey
>>
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/CXF%2C-osgi-and-tomcat-problem-tp27223821p27223821.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>
>>
>>
>
> -- 
> View this message in context: http://old.nabble.com/CXF%2C-osgi-and-tomcat-problem-tp27223821p27241016.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 


Mime
View raw message