felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dhiego Abrantes de Oliveira Martins <dhi...@dhiegoabrantes.com>
Subject Re: Question about accessing component dosgi
Date Wed, 27 Feb 2013 04:19:11 GMT
The access to this service should occurs outside of framework (felix
container). This is one of reasons of because I mustn't use dependency
injection.

anyone can help me?

best regarsd!

__
*Dhiego** **Abrantes*


2013/2/27 Dhiego Abrantes de Oliveira Martins <dhiego@dhiegoabrantes.com>

> Hi,
>
> I'm exporting a dosgi component as a webservice and I like do access him.
> I'm using iPOJO.
>
> *Interface:*
> public interface AdderService{
>           String add();
> }
>
> *Provider:*
> public class AdderServiceImpl implements AdderService{
>           public String add(){
>                     return "dhiego";
>           }
> }
>
> *Provider metadata.xml*
> <ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="org.apache.felix.ipojo
> http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd"
> xmlns="org.apache.felix.ipojo">
>      <instance
> component="org.apache.felix.ipojo.remote.adder.impl.AdderServiceImpl">
>           <property name="service.exported.interfaces" value="*" />
>           <property name="osgi.remote.configuration.type" value="pojo"/>
>           <property name="service.exported.configs" value="
> org.apache.cxf.ws" />
>           <property name="org.apache.cxf.ws.address" value="
> http://localhost:9090/adder" />
>      </instance>
> </ipojo>
>
> So, I dont want to use dependence injection. Given some architectural
> restrictions, I have to call the services as follow:
>
>     JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
>     factory.getInInterceptors().add(new LoggingInInterceptor());
>     factory.getOutInterceptors().add(new LoggingOutInterceptor());
>     factory.setServiceClass(AdderService.class);
>     factory.setAddress("http://localhost:9090/adder");
>     AdderService client = (AdderService) factory.create();
>    * String a = client.add();*
>     System.out.println(a);
>
> When the *bold* line is executed, I get this error:
>
>  Exception in thread "main" javax.xml.ws.WebServiceException: Could not
> find wsdl:binding operation info for web method add.
> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:112)
> at $Proxy30.add(Unknown Source)
> at Main.main(Main.java:22)
>
> The cause basically is the AdderService wasn't annotated with @WebService.
> If we use the @WebService in interface AdderService, the problem will be
> solved. However, the service won't be recongnized when we try to import it
> in another container to use it as a distributed osgi component.
>
> Anyone can help me?
>
>
> Best regards!
> __
> *Dhiego** **Abrantes*
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message