You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Dhiego Abrantes de Oliveira Martins <dh...@dhiegoabrantes.com> on 2013/05/17 07:27:01 UTC

[cxf] Question about exposing endpoint

Hi all,

I have a problem with CXF. I'm trying to develop a WebService as a Bundle
OSGi and I'm using iPOJO + Maven. So, I included 'cxf-rt-transports-http'
and 'cxf-rt-frontend-jaxws' as dependencies. Both on version 2.6.5.

What seem is that when I start the bundle, an specific instance of jetty is
created according to properties. The main problem is that I cant access the
service from another computer, for example, using real ip address. I just
can access from localhost.

There are some way to expose webservice through real ip address?

Thanks in advance!

Some properties (metadata.xml):
<instance component="br.com.appService.impl.ApplicationServiceImpl">
    <property name="service.exported.interfaces" value="*"/>
      <property name="service.exported.configs " value="org.apache.cxf.ws"
/>
      <property name="org.apache.cxf.ws.address" value="
http://localhost:9090/appService" />
  </instance>

Bundles:
START LEVEL 1

   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (4.0.3)
[   1] [Active     ] [    1] Distributed OSGi Distribution Software
Single-Bundle Distribution (1.3.1)
[   2] [Active     ] [    1] Apache Felix Bundle Repository (1.4.3)
[   3] [Active     ] [    1] Apache Felix Configuration Admin Service
(1.2.6)
[   4] [Active     ] [    1] Apache Felix EventAdmin (1.2.2)
[   5] [Active     ] [    1] Apache Felix iPOJO (1.6.0)
[   6] [Active     ] [    1] Apache Felix iPOJO Arch Command (1.6.0)
[   7] [Active     ] [    1] Apache Felix Shell Service (1.4.2)
[   8] [Active     ] [    1] Apache Felix Shell TUI (1.4.1)
[   9] [Active     ] [    1] Apache Felix File Install (3.2.6)
[ 100] [Active     ] [    1] OSGi OBR Service API (1)
[ 134] [Active     ] [    1] Activation 1.1 (1.1)
[ 135] [Active     ] [    1] Apache ServiceMix :: Specs :: Stax API 1.0
(1.8.0)
[ 136] [Active     ] [    1] Apache ServiceMix Specs :: JAXB API 2.1 (1.1.0)
[ 137] [Active     ] [    1] Apache ServiceMix Bundles: jaxb-impl-2.1.6
(2.1.6.1)
[ 222] [Active     ] [    1] osgi.cmpn (4.2.0.200908310645)
[ 231] [Active     ] [    1] Apache Log4J (1.2.15)
[ 446] [Active     ] [    1] Apache Felix Http Api (2.2.0)
[ 447] [Active     ] [    1] Apache Felix Http Base (2.2.0)
[ 448] [Active     ] [    1] Apache Felix Http Bridge (2.2.0)
[ 449] [Active     ] [    1] Apache Felix Http Bundle (2.2.0)
[ 450] [Active     ] [    1] Apache Felix Http Jetty (2.2.0)
[ 451] [Active     ] [    1] Apache Felix Http Proxy (2.2.0)
[ 452] [Active     ] [    1] Apache Felix Http Whiteboard (2.2.0)

__
*Dhiego** **Abrantes*

Re: [cxf] Question about exposing endpoint

Posted by Dhiego Abrantes de Oliveira Martins <dh...@dhiegoabrantes.com>.
doesnt work :(

My local ip address is 172.20.26.209. So, I'm trying to access by
http://172.20.26.209:9090/appService. But, I just can access using
http://localhost:9090/appService or replacing 'localhost' by '127.0.0.1'.

The best way is use embedded jetty or Apache Felix Http Jetty?

Thanks in advance!
__
*Dhiego** **Abrantes*


2013/5/17 Freeman Fang <fr...@gmail.com>

> Hi,
>
> You publish the webservice endpoint to localhost only, so it could be only
> accessed by localhost.
> change
>  <property name="org.apache.cxf.ws.address" value="
> http://localhost:9090/appService" />
> to
>  <property name="org.apache.cxf.ws.address" value="
> http://0.0.0.0:9090/appService" />
>
> which means bind the address to all available network interfaces, so that
> could be accessed outside
> -------------
> Freeman(Yue) Fang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://fusesource.com | http://www.redhat.com/
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: @Freeman小屋
>
> www.camelone.org : The open source integration conference:
>
> On 2013-5-17, at 下午1:27, Dhiego Abrantes de Oliveira Martins wrote:
>
> > Hi all,
> >
> > I have a problem with CXF. I'm trying to develop a WebService as a Bundle
> > OSGi and I'm using iPOJO + Maven. So, I included 'cxf-rt-transports-http'
> > and 'cxf-rt-frontend-jaxws' as dependencies. Both on version 2.6.5.
> >
> > What seem is that when I start the bundle, an specific instance of jetty
> is
> > created according to properties. The main problem is that I cant access
> the
> > service from another computer, for example, using real ip address. I just
> > can access from localhost.
> >
> > There are some way to expose webservice through real ip address?
> >
> > Thanks in advance!
> >
> > Some properties (metadata.xml):
> > <instance component="br.com.appService.impl.ApplicationServiceImpl">
> >    <property name="service.exported.interfaces" value="*"/>
> >      <property name="service.exported.configs " value="org.apache.cxf.ws
> "
> > />
> >      <property name="org.apache.cxf.ws.address" value="
> > http://localhost:9090/appService" />
> >  </instance>
> >
> > Bundles:
> > START LEVEL 1
> >
> >   ID   State         Level  Name
> > [   0] [Active     ] [    0] System Bundle (4.0.3)
> > [   1] [Active     ] [    1] Distributed OSGi Distribution Software
> > Single-Bundle Distribution (1.3.1)
> > [   2] [Active     ] [    1] Apache Felix Bundle Repository (1.4.3)
> > [   3] [Active     ] [    1] Apache Felix Configuration Admin Service
> > (1.2.6)
> > [   4] [Active     ] [    1] Apache Felix EventAdmin (1.2.2)
> > [   5] [Active     ] [    1] Apache Felix iPOJO (1.6.0)
> > [   6] [Active     ] [    1] Apache Felix iPOJO Arch Command (1.6.0)
> > [   7] [Active     ] [    1] Apache Felix Shell Service (1.4.2)
> > [   8] [Active     ] [    1] Apache Felix Shell TUI (1.4.1)
> > [   9] [Active     ] [    1] Apache Felix File Install (3.2.6)
> > [ 100] [Active     ] [    1] OSGi OBR Service API (1)
> > [ 134] [Active     ] [    1] Activation 1.1 (1.1)
> > [ 135] [Active     ] [    1] Apache ServiceMix :: Specs :: Stax API 1.0
> > (1.8.0)
> > [ 136] [Active     ] [    1] Apache ServiceMix Specs :: JAXB API 2.1
> (1.1.0)
> > [ 137] [Active     ] [    1] Apache ServiceMix Bundles: jaxb-impl-2.1.6
> > (2.1.6.1)
> > [ 222] [Active     ] [    1] osgi.cmpn (4.2.0.200908310645)
> > [ 231] [Active     ] [    1] Apache Log4J (1.2.15)
> > [ 446] [Active     ] [    1] Apache Felix Http Api (2.2.0)
> > [ 447] [Active     ] [    1] Apache Felix Http Base (2.2.0)
> > [ 448] [Active     ] [    1] Apache Felix Http Bridge (2.2.0)
> > [ 449] [Active     ] [    1] Apache Felix Http Bundle (2.2.0)
> > [ 450] [Active     ] [    1] Apache Felix Http Jetty (2.2.0)
> > [ 451] [Active     ] [    1] Apache Felix Http Proxy (2.2.0)
> > [ 452] [Active     ] [    1] Apache Felix Http Whiteboard (2.2.0)
> >
> > __
> > *Dhiego** **Abrantes*
>
>

Re: [cxf] Question about exposing endpoint

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

You publish the webservice endpoint to localhost only, so it could be only accessed by localhost.
change
 <property name="org.apache.cxf.ws.address" value="
http://localhost:9090/appService" />
to
 <property name="org.apache.cxf.ws.address" value="
http://0.0.0.0:9090/appService" />

which means bind the address to all available network interfaces, so that could be accessed outside
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋

www.camelone.org : The open source integration conference: 

On 2013-5-17, at 下午1:27, Dhiego Abrantes de Oliveira Martins wrote:

> Hi all,
> 
> I have a problem with CXF. I'm trying to develop a WebService as a Bundle
> OSGi and I'm using iPOJO + Maven. So, I included 'cxf-rt-transports-http'
> and 'cxf-rt-frontend-jaxws' as dependencies. Both on version 2.6.5.
> 
> What seem is that when I start the bundle, an specific instance of jetty is
> created according to properties. The main problem is that I cant access the
> service from another computer, for example, using real ip address. I just
> can access from localhost.
> 
> There are some way to expose webservice through real ip address?
> 
> Thanks in advance!
> 
> Some properties (metadata.xml):
> <instance component="br.com.appService.impl.ApplicationServiceImpl">
>    <property name="service.exported.interfaces" value="*"/>
>      <property name="service.exported.configs " value="org.apache.cxf.ws"
> />
>      <property name="org.apache.cxf.ws.address" value="
> http://localhost:9090/appService" />
>  </instance>
> 
> Bundles:
> START LEVEL 1
> 
>   ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (4.0.3)
> [   1] [Active     ] [    1] Distributed OSGi Distribution Software
> Single-Bundle Distribution (1.3.1)
> [   2] [Active     ] [    1] Apache Felix Bundle Repository (1.4.3)
> [   3] [Active     ] [    1] Apache Felix Configuration Admin Service
> (1.2.6)
> [   4] [Active     ] [    1] Apache Felix EventAdmin (1.2.2)
> [   5] [Active     ] [    1] Apache Felix iPOJO (1.6.0)
> [   6] [Active     ] [    1] Apache Felix iPOJO Arch Command (1.6.0)
> [   7] [Active     ] [    1] Apache Felix Shell Service (1.4.2)
> [   8] [Active     ] [    1] Apache Felix Shell TUI (1.4.1)
> [   9] [Active     ] [    1] Apache Felix File Install (3.2.6)
> [ 100] [Active     ] [    1] OSGi OBR Service API (1)
> [ 134] [Active     ] [    1] Activation 1.1 (1.1)
> [ 135] [Active     ] [    1] Apache ServiceMix :: Specs :: Stax API 1.0
> (1.8.0)
> [ 136] [Active     ] [    1] Apache ServiceMix Specs :: JAXB API 2.1 (1.1.0)
> [ 137] [Active     ] [    1] Apache ServiceMix Bundles: jaxb-impl-2.1.6
> (2.1.6.1)
> [ 222] [Active     ] [    1] osgi.cmpn (4.2.0.200908310645)
> [ 231] [Active     ] [    1] Apache Log4J (1.2.15)
> [ 446] [Active     ] [    1] Apache Felix Http Api (2.2.0)
> [ 447] [Active     ] [    1] Apache Felix Http Base (2.2.0)
> [ 448] [Active     ] [    1] Apache Felix Http Bridge (2.2.0)
> [ 449] [Active     ] [    1] Apache Felix Http Bundle (2.2.0)
> [ 450] [Active     ] [    1] Apache Felix Http Jetty (2.2.0)
> [ 451] [Active     ] [    1] Apache Felix Http Proxy (2.2.0)
> [ 452] [Active     ] [    1] Apache Felix Http Whiteboard (2.2.0)
> 
> __
> *Dhiego** **Abrantes*


Re: [cxf] Question about exposing endpoint

Posted by Dhiego Abrantes de Oliveira Martins <dh...@dhiegoabrantes.com>.
Yes! That's working fine. Thank you very much!

Best regards,
__
*Dhiego** **Abrantes*


2013/5/17 Christian Schneider <ch...@die-schneider.net>

> If you used DOSGi 1.4.0 you can also use
>
> <property name="org.apache.cxf.ws.**address" value="/appService"/>
>
> In this case CXF will use the servlet transport which uses the HTTPService
> to create a service URI like:
> http://hostname:port/cxf/**appService
>
> You can then configure the port using the normal pax web config. This has
> the advantage that you do not have to care about the port in your services.
>
> Christian
>
>
>
>
> On 17.05.2013 07:27, Dhiego Abrantes de Oliveira Martins wrote:
>
>> Hi all,
>>
>> I have a problem with CXF. I'm trying to develop a WebService as a Bundle
>> OSGi and I'm using iPOJO + Maven. So, I included 'cxf-rt-transports-http'
>> and 'cxf-rt-frontend-jaxws' as dependencies. Both on version 2.6.5.
>>
>> What seem is that when I start the bundle, an specific instance of jetty
>> is
>> created according to properties. The main problem is that I cant access
>> the
>> service from another computer, for example, using real ip address. I just
>> can access from localhost.
>>
>> There are some way to expose webservice through real ip address?
>>
>> Thanks in advance!
>>
>> Some properties (metadata.xml):
>> <instance component="br.com.appService.**impl.ApplicationServiceImpl">
>>      <property name="service.exported.**interfaces" value="*"/>
>>        <property name="service.exported.configs " value="
>> org.apache.cxf.ws"
>> />
>>        <property name="org.apache.cxf.ws.**address" value="
>> http://localhost:9090/**appService <http://localhost:9090/appService>" />
>>    </instance>
>>
>> Bundles:
>> START LEVEL 1
>>
>>     ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (4.0.3)
>> [   1] [Active     ] [    1] Distributed OSGi Distribution Software
>> Single-Bundle Distribution (1.3.1)
>> [   2] [Active     ] [    1] Apache Felix Bundle Repository (1.4.3)
>> [   3] [Active     ] [    1] Apache Felix Configuration Admin Service
>> (1.2.6)
>> [   4] [Active     ] [    1] Apache Felix EventAdmin (1.2.2)
>> [   5] [Active     ] [    1] Apache Felix iPOJO (1.6.0)
>> [   6] [Active     ] [    1] Apache Felix iPOJO Arch Command (1.6.0)
>> [   7] [Active     ] [    1] Apache Felix Shell Service (1.4.2)
>> [   8] [Active     ] [    1] Apache Felix Shell TUI (1.4.1)
>> [   9] [Active     ] [    1] Apache Felix File Install (3.2.6)
>> [ 100] [Active     ] [    1] OSGi OBR Service API (1)
>> [ 134] [Active     ] [    1] Activation 1.1 (1.1)
>> [ 135] [Active     ] [    1] Apache ServiceMix :: Specs :: Stax API 1.0
>> (1.8.0)
>> [ 136] [Active     ] [    1] Apache ServiceMix Specs :: JAXB API 2.1
>> (1.1.0)
>> [ 137] [Active     ] [    1] Apache ServiceMix Bundles: jaxb-impl-2.1.6
>> (2.1.6.1)
>> [ 222] [Active     ] [    1] osgi.cmpn (4.2.0.200908310645)
>> [ 231] [Active     ] [    1] Apache Log4J (1.2.15)
>> [ 446] [Active     ] [    1] Apache Felix Http Api (2.2.0)
>> [ 447] [Active     ] [    1] Apache Felix Http Base (2.2.0)
>> [ 448] [Active     ] [    1] Apache Felix Http Bridge (2.2.0)
>> [ 449] [Active     ] [    1] Apache Felix Http Bundle (2.2.0)
>> [ 450] [Active     ] [    1] Apache Felix Http Jetty (2.2.0)
>> [ 451] [Active     ] [    1] Apache Felix Http Proxy (2.2.0)
>> [ 452] [Active     ] [    1] Apache Felix Http Whiteboard (2.2.0)
>>
>> __
>> *Dhiego** **Abrantes*
>>
>>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>
>

Re: [cxf] Question about exposing endpoint

Posted by Christian Schneider <ch...@die-schneider.net>.
If you used DOSGi 1.4.0 you can also use

<property name="org.apache.cxf.ws.address" value="/appService"/>

In this case CXF will use the servlet transport which uses the 
HTTPService to create a service URI like:
http://hostname:port/cxf/appService

You can then configure the port using the normal pax web config. This 
has the advantage that you do not have to care about the port in your 
services.

Christian



On 17.05.2013 07:27, Dhiego Abrantes de Oliveira Martins wrote:
> Hi all,
>
> I have a problem with CXF. I'm trying to develop a WebService as a Bundle
> OSGi and I'm using iPOJO + Maven. So, I included 'cxf-rt-transports-http'
> and 'cxf-rt-frontend-jaxws' as dependencies. Both on version 2.6.5.
>
> What seem is that when I start the bundle, an specific instance of jetty is
> created according to properties. The main problem is that I cant access the
> service from another computer, for example, using real ip address. I just
> can access from localhost.
>
> There are some way to expose webservice through real ip address?
>
> Thanks in advance!
>
> Some properties (metadata.xml):
> <instance component="br.com.appService.impl.ApplicationServiceImpl">
>      <property name="service.exported.interfaces" value="*"/>
>        <property name="service.exported.configs " value="org.apache.cxf.ws"
> />
>        <property name="org.apache.cxf.ws.address" value="
> http://localhost:9090/appService" />
>    </instance>
>
> Bundles:
> START LEVEL 1
>
>     ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (4.0.3)
> [   1] [Active     ] [    1] Distributed OSGi Distribution Software
> Single-Bundle Distribution (1.3.1)
> [   2] [Active     ] [    1] Apache Felix Bundle Repository (1.4.3)
> [   3] [Active     ] [    1] Apache Felix Configuration Admin Service
> (1.2.6)
> [   4] [Active     ] [    1] Apache Felix EventAdmin (1.2.2)
> [   5] [Active     ] [    1] Apache Felix iPOJO (1.6.0)
> [   6] [Active     ] [    1] Apache Felix iPOJO Arch Command (1.6.0)
> [   7] [Active     ] [    1] Apache Felix Shell Service (1.4.2)
> [   8] [Active     ] [    1] Apache Felix Shell TUI (1.4.1)
> [   9] [Active     ] [    1] Apache Felix File Install (3.2.6)
> [ 100] [Active     ] [    1] OSGi OBR Service API (1)
> [ 134] [Active     ] [    1] Activation 1.1 (1.1)
> [ 135] [Active     ] [    1] Apache ServiceMix :: Specs :: Stax API 1.0
> (1.8.0)
> [ 136] [Active     ] [    1] Apache ServiceMix Specs :: JAXB API 2.1 (1.1.0)
> [ 137] [Active     ] [    1] Apache ServiceMix Bundles: jaxb-impl-2.1.6
> (2.1.6.1)
> [ 222] [Active     ] [    1] osgi.cmpn (4.2.0.200908310645)
> [ 231] [Active     ] [    1] Apache Log4J (1.2.15)
> [ 446] [Active     ] [    1] Apache Felix Http Api (2.2.0)
> [ 447] [Active     ] [    1] Apache Felix Http Base (2.2.0)
> [ 448] [Active     ] [    1] Apache Felix Http Bridge (2.2.0)
> [ 449] [Active     ] [    1] Apache Felix Http Bundle (2.2.0)
> [ 450] [Active     ] [    1] Apache Felix Http Jetty (2.2.0)
> [ 451] [Active     ] [    1] Apache Felix Http Proxy (2.2.0)
> [ 452] [Active     ] [    1] Apache Felix Http Whiteboard (2.2.0)
>
> __
> *Dhiego** **Abrantes*
>


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com