CXF-DOSGi Port Puzzle

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

CXF-DOSGi Port Puzzle

Erwin Hogeweg-2
Hi,

I have a couple of OSGi services which are available as remote OSGi service with CXF-DOSGi. The services are registered with the following props, and that all works fine:

Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put("name", "MyServiceImpl");
props.put("type", "internal");
props.put("service.exported.interfaces", "*");
props.put("service.exported.configs", "org.apache.cxf.ws");
props.put("org.apache.cxf.ws.address", "http://" + serviceHost + ":" + servicePort + "/MyService");
props.put("org.apache.cxf.ws.httpservice.context", "/MyService");

However, I would like to use the port defined with org.osgi.service.http.port property as the service port. That doesn’t work though because CXF  creates a new instance of JettyHttpDestination for every used port. This is from JettyHttpDesitination.java where servers for ea. port are created:

    protected void retrieveEngine()
        throws GeneralSecurityException,
               IOException {
        if (serverEngineFactory == null) {
            return;
        }
        engine =
            serverEngineFactory.retrieveJettyHTTPServerEngine(nurl.getPort());
        if (engine == null) {
            engine = serverEngineFactory.
                createJettyHTTPServerEngine(nurl.getHost(), nurl.getPort(), nurl.getProtocol());
        }

And port 8088 is already claimed by the HttpService registered by CXF:

g! services (objectClass=*HttpService)
{org.osgi.service.http.HttpService, org.eclipse.equinox.http.servlet.ExtendedHttpService}={service.description=Equinox Jetty-based Http Service, service.vendor=Eclipse.org<http://Eclipse.org>, http.port=8088, service.id=64, service.bundleid=31, service.scope=bundle}
  "Registered by bundle:" org.eclipse.equinox.http.servlet_1.1.400.v20130418-1354 [31]
  "Bundles using service"
    org.apache.cxf.cxf-rt-transports-http_3.1.6 [82]
    cxf-dosgi-ri-dsw-cxf_1.7.0 [138]

The CXF-DOSGi documentation<http://cxf.apache.org/distributed-osgi-reference.html> says about the org.apache.cxf.ws.httpservice.contex:
"When this property is specified, the OSGi HTTP Service is used to expose the service, rather than a dedicated Jetty HTTP Server. This property doesn't allow the specification of a port number, as this is provided by the HTTP Service. The Distributed OSGi distributions come with Pax-Web, for which configuration information can be found at http://wiki.ops4j.org/display/paxweb/Configuration, however other OSGi HTTP Service implementations are potentially configured differently.”

When I try that, the service is bound to localhost:9000 instead of 0.0.0.0:8088, which seems to happen in org.apache.cxf.dosgi.dsw.handlers.PojoConfiguration.java:

    private String getPojoAddress(Map<String, Object> sd, Class<?> iClass) {
        String address = getClientAddress(sd);
        if (address != null) {
            return address;
        }

        // If the property is not of type string this will cause an ClassCastException which
        // will be propagated to the ExportRegistration exception property.
        Object port = sd.get(Constants.WS_PORT_PROPERTY);
        if (port == null) {
            port = "9000";
        }

        address = "http://localhost:" + port + "/" + iClass.getName().replace('.', '/');
        LOG.info("Using a default address: " + address);
        return address;
    }

I am trying to understand what I am missing for a while now, and every now and again on a quiet Fri. afternoon (…) I take another stab at it, but I am not getting much further.

FWIW… the CXF servlet IS registered under the port defined by org.osgi.service.http.port.

This is all based on
CXF: 3.1.6 and CXF-DOSGi: 1.7.0
Java 8
Eclipse Equinox 3.10.2

I checked the release notes for 1.8.0 but didn’t see anything related to this issue.

Any suggestions or pointers in the right directions would be greatly appreciated.


Thanks,

Erwin
Erwin Hogeweg
CTO
3690 Airport Road
Boca Raton, FL 33431
P. +1 (954) 556-6565
M. +1 (561) 306-7395
F. +1 (561) 948-2730
[Seecago]<http://www.seecago.com>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CXF-DOSGi Port Puzzle

cschneider
Hi Erwin,

simply use the address:

props.put("org.apache.cxf.ws.address", "/MyService");

and no context. This way each of your services can have its own path and
all will share the http service port.

Christian

2017-07-29 19:52 GMT+02:00 Erwin Hogeweg <[hidden email]>:

> Hi,
>
> I have a couple of OSGi services which are available as remote OSGi
> service with CXF-DOSGi. The services are registered with the following
> props, and that all works fine:
>
> Dictionary<String, Object> props = new Hashtable<String, Object>();
> props.put("name", "MyServiceImpl");
> props.put("type", "internal");
> props.put("service.exported.interfaces", "*");
> props.put("service.exported.configs", "org.apache.cxf.ws");
> props.put("org.apache.cxf.ws.address", "http://" + serviceHost + ":" +
> servicePort + "/MyService");
> props.put("org.apache.cxf.ws.httpservice.context", "/MyService");
>
> However, I would like to use the port defined with
> org.osgi.service.http.port property as the service port. That doesn’t work
> though because CXF  creates a new instance of JettyHttpDestination for
> every used port. This is from JettyHttpDesitination.java where servers for
> ea. port are created:
>
>     protected void retrieveEngine()
>         throws GeneralSecurityException,
>                IOException {
>         if (serverEngineFactory == null) {
>             return;
>         }
>         engine =
>             serverEngineFactory.retrieveJettyHTTPServerEngine(
> nurl.getPort());
>         if (engine == null) {
>             engine = serverEngineFactory.
>                 createJettyHTTPServerEngine(nurl.getHost(),
> nurl.getPort(), nurl.getProtocol());
>         }
>
> And port 8088 is already claimed by the HttpService registered by CXF:
>
> g! services (objectClass=*HttpService)
> {org.osgi.service.http.HttpService, org.eclipse.equinox.http.
> servlet.ExtendedHttpService}={service.description=Equinox Jetty-based
> Http Service, service.vendor=Eclipse.org<http://Eclipse.org>,
> http.port=8088, service.id=64, service.bundleid=31, service.scope=bundle}
>   "Registered by bundle:" org.eclipse.equinox.http.servlet_1.1.400.v20130418-1354
> [31]
>   "Bundles using service"
>     org.apache.cxf.cxf-rt-transports-http_3.1.6 [82]
>     cxf-dosgi-ri-dsw-cxf_1.7.0 [138]
>
> The CXF-DOSGi documentation<http://cxf.apache.org/distributed-osgi-
> reference.html> says about the org.apache.cxf.ws.httpservice.contex:
> "When this property is specified, the OSGi HTTP Service is used to expose
> the service, rather than a dedicated Jetty HTTP Server. This property
> doesn't allow the specification of a port number, as this is provided by
> the HTTP Service. The Distributed OSGi distributions come with Pax-Web, for
> which configuration information can be found at
> http://wiki.ops4j.org/display/paxweb/Configuration, however other OSGi
> HTTP Service implementations are potentially configured differently.”
>
> When I try that, the service is bound to localhost:9000 instead of
> 0.0.0.0:8088, which seems to happen in org.apache.cxf.dosgi.dsw.
> handlers.PojoConfiguration.java:
>
>     private String getPojoAddress(Map<String, Object> sd, Class<?> iClass)
> {
>         String address = getClientAddress(sd);
>         if (address != null) {
>             return address;
>         }
>
>         // If the property is not of type string this will cause an
> ClassCastException which
>         // will be propagated to the ExportRegistration exception property.
>         Object port = sd.get(Constants.WS_PORT_PROPERTY);
>         if (port == null) {
>             port = "9000";
>         }
>
>         address = "http://localhost:" + port + "/" +
> iClass.getName().replace('.', '/');
>         LOG.info("Using a default address: " + address);
>         return address;
>     }
>
> I am trying to understand what I am missing for a while now, and every now
> and again on a quiet Fri. afternoon (…) I take another stab at it, but I am
> not getting much further.
>
> FWIW… the CXF servlet IS registered under the port defined by
> org.osgi.service.http.port.
>
> This is all based on
> CXF: 3.1.6 and CXF-DOSGi: 1.7.0
> Java 8
> Eclipse Equinox 3.10.2
>
> I checked the release notes for 1.8.0 but didn’t see anything related to
> this issue.
>
> Any suggestions or pointers in the right directions would be greatly
> appreciated.
>
>
> Thanks,
>
> Erwin
> Erwin Hogeweg
> CTO
> 3690 Airport Road
> Boca Raton, FL 33431
> P. +1 (954) 556-6565
> M. +1 (561) 306-7395
> F. +1 (561) 948-2730
> [Seecago]<http://www.seecago.com>
>



--
--
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CXF-DOSGi Port Puzzle

Erwin Hogeweg-2
Hi Christan,

Thanks for your reply,

simply use the address:

props.put("org.apache.cxf.ws.address", "/MyService");

and no context. This way each of your services can have its own path and
all will share the http service port.
I had tried that, but that doesn’t quite work either. I get the wrong port, and ‘cxf’ is added to the context:

g! props
System properties:
...
org.osgi.service.http.port = 8088

2017-07-30 11:51:12,624 [INFO ] pool-3-thread-1 TopologyManagerExport:218 TopologyManager: export successful for {my.service.interfaces.MyService}={org.apache.cxf.ws.address=/MyService, name=MyServiceImpl, type=internal, service.exported.configs=org.apache.cxf.ws, service.exported.interfaces=*, service.id=149, service.bundleid=118, service.scope=singleton}, endpoints: [{endpoint.framework.uuid=d0b196e5-3e75-0017-138b-f8dd2f9e5e15, endpoint.id=http://192.168.180.1:8181/cxf/MyService, endpoint.package.version.my.service.interfaces=4.1.0, endpoint.service.id=149, name=MyServiceImpl, objectClass=[my.service.interfaces.MyService], org.apache.cxf.ws.address=http://192.168.180.1:8181/cxf/MyService, service.bundleid=118, service.imported=true, service.imported.configs=[org.apache.cxf.ws], service.intents=[SOAP.1_1, HTTP, SOAP], service.scope=singleton, type=internal}]

Oh, that’s interesting, the port in the endpoint.id and the address above is incorrect. The wsdl IS available as http://localhost:8088/cxf/MyService?wsdl.

So the only challenge appear to be to remove the ‘cxf’ from the path (the consumers of the service have the path hardcoded in the remoteservice.xml file). Any ideas about that?


Thanks,

Erwin


Christian

2017-07-29 19:52 GMT+02:00 Erwin Hogeweg <[hidden email]<mailto:[hidden email]>>:

Hi,

I have a couple of OSGi services which are available as remote OSGi
service with CXF-DOSGi. The services are registered with the following
props, and that all works fine:

Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put("name", "MyServiceImpl");
props.put("type", "internal");
props.put("service.exported.interfaces", "*");
props.put("service.exported.configs", "org.apache.cxf.ws");
props.put("org.apache.cxf.ws.address", "http://" + serviceHost + ":" +
servicePort + "/MyService");
props.put("org.apache.cxf.ws.httpservice.context", "/MyService");

However, I would like to use the port defined with
org.osgi.service.http.port property as the service port. That doesn’t work
though because CXF  creates a new instance of JettyHttpDestination for
every used port. This is from JettyHttpDesitination.java where servers for
ea. port are created:

   protected void retrieveEngine()
       throws GeneralSecurityException,
              IOException {
       if (serverEngineFactory == null) {
           return;
       }
       engine =
           serverEngineFactory.retrieveJettyHTTPServerEngine(
nurl.getPort());
       if (engine == null) {
           engine = serverEngineFactory.
               createJettyHTTPServerEngine(nurl.getHost(),
nurl.getPort(), nurl.getProtocol());
       }

And port 8088 is already claimed by the HttpService registered by CXF:

g! services (objectClass=*HttpService)
{org.osgi.service.http.HttpService, org.eclipse.equinox.http.
servlet.ExtendedHttpService}={service.description=Equinox Jetty-based
Http Service, service.vendor=Eclipse.org<http://Eclipse.org><http://Eclipse.org>,
http.port=8088, service.id=64, service.bundleid=31, service.scope=bundle}
 "Registered by bundle:" org.eclipse.equinox.http.servlet_1.1.400.v20130418-1354
[31]
 "Bundles using service"
   org.apache.cxf.cxf-rt-transports-http_3.1.6 [82]
   cxf-dosgi-ri-dsw-cxf_1.7.0 [138]

The CXF-DOSGi documentation<http://cxf.apache.org/distributed-osgi-
reference.html> says about the org.apache.cxf.ws.httpservice.contex:
"When this property is specified, the OSGi HTTP Service is used to expose
the service, rather than a dedicated Jetty HTTP Server. This property
doesn't allow the specification of a port number, as this is provided by
the HTTP Service. The Distributed OSGi distributions come with Pax-Web, for
which configuration information can be found at
http://wiki.ops4j.org/display/paxweb/Configuration, however other OSGi
HTTP Service implementations are potentially configured differently.”

When I try that, the service is bound to localhost:9000 instead of
0.0.0.0:8088, which seems to happen in org.apache.cxf.dosgi.dsw.
handlers.PojoConfiguration.java:

   private String getPojoAddress(Map<String, Object> sd, Class<?> iClass)
{
       String address = getClientAddress(sd);
       if (address != null) {
           return address;
       }

       // If the property is not of type string this will cause an
ClassCastException which
       // will be propagated to the ExportRegistration exception property.
       Object port = sd.get(Constants.WS_PORT_PROPERTY);
       if (port == null) {
           port = "9000";
       }

       address = "http://localhost:" + port + "/" +
iClass.getName().replace('.', '/');
       LOG.info<http://LOG.info>("Using a default address: " + address);
       return address;
   }

I am trying to understand what I am missing for a while now, and every now
and again on a quiet Fri. afternoon (…) I take another stab at it, but I am
not getting much further.

FWIW… the CXF servlet IS registered under the port defined by
org.osgi.service.http.port.

This is all based on
CXF: 3.1.6 and CXF-DOSGi: 1.7.0
Java 8
Eclipse Equinox 3.10.2

I checked the release notes for 1.8.0 but didn’t see anything related to
this issue.

Any suggestions or pointers in the right directions would be greatly
appreciated.


Thanks,

Erwin
Erwin Hogeweg
CTO
3690 Airport Road
Boca Raton, FL 33431
P. +1 (954) 556-6565
M. +1 (561) 306-7395
F. +1 (561) 948-2730
[Seecago]<http://www.seecago.com>




--
--
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>

Erwin Hogeweg
CTO
3690 Airport Road
Boca Raton, FL 33431
P. +1 (954) 556-6565
M. +1 (561) 306-7395
F. +1 (561) 948-2730
[Seecago]<http://www.seecago.com>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CXF-DOSGi Port Puzzle

cschneider
You can change the path from cxf to something else but you can not remove
it.

Christian

2017-07-30 18:08 GMT+02:00 Erwin Hogeweg <[hidden email]>:

> Hi Christan,
>
> Thanks for your reply,
>
> simply use the address:
>
> props.put("org.apache.cxf.ws.address", "/MyService");
>
> and no context. This way each of your services can have its own path and
> all will share the http service port.
> I had tried that, but that doesn’t quite work either. I get the wrong
> port, and ‘cxf’ is added to the context:
>
> g! props
> System properties:
> ...
> org.osgi.service.http.port = 8088
>
> 2017-07-30 11:51:12,624 [INFO ] pool-3-thread-1 TopologyManagerExport:218
> TopologyManager: export successful for {my.service.interfaces.MyService}={
> org.apache.cxf.ws.address=/MyService, name=MyServiceImpl, type=internal,
> service.exported.configs=org.apache.cxf.ws,
> service.exported.interfaces=*, service.id=149, service.bundleid=118,
> service.scope=singleton}, endpoints: [{endpoint.framework.uuid=
> d0b196e5-3e75-0017-138b-f8dd2f9e5e15, endpoint.id=http://192.168.
> 180.1:8181/cxf/MyService, endpoint.package.version.my.service.interfaces=4.1.0,
> endpoint.service.id=149, name=MyServiceImpl, objectClass=[my.service.interfaces.MyService],
> org.apache.cxf.ws.address=http://192.168.180.1:8181/cxf/MyService,
> service.bundleid=118, service.imported=true, service.imported.configs=[
> org.apache.cxf.ws], service.intents=[SOAP.1_1, HTTP, SOAP],
> service.scope=singleton, type=internal}]
>
> Oh, that’s interesting, the port in the endpoint.id and the address above
> is incorrect. The wsdl IS available as http://localhost:8088/cxf/
> MyService?wsdl.
>
> So the only challenge appear to be to remove the ‘cxf’ from the path (the
> consumers of the service have the path hardcoded in the remoteservice.xml
> file). Any ideas about that?
>
>
> Thanks,
>
> Erwin
>
>
> Christian
>
> 2017-07-29 19:52 GMT+02:00 Erwin Hogeweg <[hidden email]<
> mailto:[hidden email]>>:
>
> Hi,
>
> I have a couple of OSGi services which are available as remote OSGi
> service with CXF-DOSGi. The services are registered with the following
> props, and that all works fine:
>
> Dictionary<String, Object> props = new Hashtable<String, Object>();
> props.put("name", "MyServiceImpl");
> props.put("type", "internal");
> props.put("service.exported.interfaces", "*");
> props.put("service.exported.configs", "org.apache.cxf.ws");
> props.put("org.apache.cxf.ws.address", "http://" + serviceHost + ":" +
> servicePort + "/MyService");
> props.put("org.apache.cxf.ws.httpservice.context", "/MyService");
>
> However, I would like to use the port defined with
> org.osgi.service.http.port property as the service port. That doesn’t work
> though because CXF  creates a new instance of JettyHttpDestination for
> every used port. This is from JettyHttpDesitination.java where servers for
> ea. port are created:
>
>    protected void retrieveEngine()
>        throws GeneralSecurityException,
>               IOException {
>        if (serverEngineFactory == null) {
>            return;
>        }
>        engine =
>            serverEngineFactory.retrieveJettyHTTPServerEngine(
> nurl.getPort());
>        if (engine == null) {
>            engine = serverEngineFactory.
>                createJettyHTTPServerEngine(nurl.getHost(),
> nurl.getPort(), nurl.getProtocol());
>        }
>
> And port 8088 is already claimed by the HttpService registered by CXF:
>
> g! services (objectClass=*HttpService)
> {org.osgi.service.http.HttpService, org.eclipse.equinox.http.
> servlet.ExtendedHttpService}={service.description=Equinox Jetty-based
> Http Service, service.vendor=Eclipse.org<http://Eclipse.org><http://
> Eclipse.org>,
> http.port=8088, service.id=64, service.bundleid=31, service.scope=bundle}
>  "Registered by bundle:" org.eclipse.equinox.http.
> servlet_1.1.400.v20130418-1354
> [31]
>  "Bundles using service"
>    org.apache.cxf.cxf-rt-transports-http_3.1.6 [82]
>    cxf-dosgi-ri-dsw-cxf_1.7.0 [138]
>
> The CXF-DOSGi documentation<http://cxf.apache.org/distributed-osgi-
> reference.html> says about the org.apache.cxf.ws.httpservice.contex:
> "When this property is specified, the OSGi HTTP Service is used to expose
> the service, rather than a dedicated Jetty HTTP Server. This property
> doesn't allow the specification of a port number, as this is provided by
> the HTTP Service. The Distributed OSGi distributions come with Pax-Web, for
> which configuration information can be found at
> http://wiki.ops4j.org/display/paxweb/Configuration, however other OSGi
> HTTP Service implementations are potentially configured differently.”
>
> When I try that, the service is bound to localhost:9000 instead of
> 0.0.0.0:8088, which seems to happen in org.apache.cxf.dosgi.dsw.
> handlers.PojoConfiguration.java:
>
>    private String getPojoAddress(Map<String, Object> sd, Class<?> iClass)
> {
>        String address = getClientAddress(sd);
>        if (address != null) {
>            return address;
>        }
>
>        // If the property is not of type string this will cause an
> ClassCastException which
>        // will be propagated to the ExportRegistration exception property.
>        Object port = sd.get(Constants.WS_PORT_PROPERTY);
>        if (port == null) {
>            port = "9000";
>        }
>
>        address = "http://localhost:" + port + "/" +
> iClass.getName().replace('.', '/');
>        LOG.info<http://LOG.info>("Using a default address: " + address);
>        return address;
>    }
>
> I am trying to understand what I am missing for a while now, and every now
> and again on a quiet Fri. afternoon (…) I take another stab at it, but I am
> not getting much further.
>
> FWIW… the CXF servlet IS registered under the port defined by
> org.osgi.service.http.port.
>
> This is all based on
> CXF: 3.1.6 and CXF-DOSGi: 1.7.0
> Java 8
> Eclipse Equinox 3.10.2
>
> I checked the release notes for 1.8.0 but didn’t see anything related to
> this issue.
>
> Any suggestions or pointers in the right directions would be greatly
> appreciated.
>
>
> Thanks,
>
> Erwin
> Erwin Hogeweg
> CTO
> 3690 Airport Road
> Boca Raton, FL 33431
> P. +1 (954) 556-6565
> M. +1 (561) 306-7395
> F. +1 (561) 948-2730
> [Seecago]<http://www.seecago.com>
>
>
>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e
> 46&URL=http%3a%2f%2fwww.liquid-reality.de>
>
> Open Source Architect
> http://www.talend.com
> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e
> 46&URL=http%3a%2f%2fwww.talend.com>
>
> Erwin Hogeweg
> CTO
> 3690 Airport Road
> Boca Raton, FL 33431
> P. +1 (954) 556-6565
> M. +1 (561) 306-7395
> F. +1 (561) 948-2730
> [Seecago]<http://www.seecago.com>
>



--
--
Christian Schneider
http://www.liquid-reality.de
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>

Open Source Architect
http://www.talend.com
<https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CXF-DOSGi Port Puzzle

Erwin Hogeweg-2
Thanks. How/where do I change it?

Regards,

Erwin

> El jul. 31, 2017, a las 01:43, Christian Schneider <[hidden email]> escribió:
>
> You can change the path from cxf to something else but you can not remove
> it.
>
> Christian
>
> 2017-07-30 18:08 GMT+02:00 Erwin Hogeweg <[hidden email]>:
>
>> Hi Christan,
>>
>> Thanks for your reply,
>>
>> simply use the address:
>>
>> props.put("org.apache.cxf.ws.address", "/MyService");
>>
>> and no context. This way each of your services can have its own path and
>> all will share the http service port.
>> I had tried that, but that doesn’t quite work either. I get the wrong
>> port, and ‘cxf’ is added to the context:
>>
>> g! props
>> System properties:
>> ...
>> org.osgi.service.http.port = 8088
>>
>> 2017-07-30 11:51:12,624 [INFO ] pool-3-thread-1 TopologyManagerExport:218
>> TopologyManager: export successful for {my.service.interfaces.MyService}={
>> org.apache.cxf.ws.address=/MyService, name=MyServiceImpl, type=internal,
>> service.exported.configs=org.apache.cxf.ws,
>> service.exported.interfaces=*, service.id=149, service.bundleid=118,
>> service.scope=singleton}, endpoints: [{endpoint.framework.uuid=
>> d0b196e5-3e75-0017-138b-f8dd2f9e5e15, endpoint.id=http://192.168.
>> 180.1:8181/cxf/MyService, endpoint.package.version.my.service.interfaces=4.1.0,
>> endpoint.service.id=149, name=MyServiceImpl, objectClass=[my.service.interfaces.MyService],
>> org.apache.cxf.ws.address=http://192.168.180.1:8181/cxf/MyService,
>> service.bundleid=118, service.imported=true, service.imported.configs=[
>> org.apache.cxf.ws], service.intents=[SOAP.1_1, HTTP, SOAP],
>> service.scope=singleton, type=internal}]
>>
>> Oh, that’s interesting, the port in the endpoint.id and the address above
>> is incorrect. The wsdl IS available as http://localhost:8088/cxf/
>> MyService?wsdl.
>>
>> So the only challenge appear to be to remove the ‘cxf’ from the path (the
>> consumers of the service have the path hardcoded in the remoteservice.xml
>> file). Any ideas about that?
>>
>>
>> Thanks,
>>
>> Erwin
>>
>>
>> Christian
>>
>> 2017-07-29 19:52 GMT+02:00 Erwin Hogeweg <[hidden email]<
>> mailto:[hidden email]>>:
>>
>> Hi,
>>
>> I have a couple of OSGi services which are available as remote OSGi
>> service with CXF-DOSGi. The services are registered with the following
>> props, and that all works fine:
>>
>> Dictionary<String, Object> props = new Hashtable<String, Object>();
>> props.put("name", "MyServiceImpl");
>> props.put("type", "internal");
>> props.put("service.exported.interfaces", "*");
>> props.put("service.exported.configs", "org.apache.cxf.ws");
>> props.put("org.apache.cxf.ws.address", "http://" + serviceHost + ":" +
>> servicePort + "/MyService");
>> props.put("org.apache.cxf.ws.httpservice.context", "/MyService");
>>
>> However, I would like to use the port defined with
>> org.osgi.service.http.port property as the service port. That doesn’t work
>> though because CXF  creates a new instance of JettyHttpDestination for
>> every used port. This is from JettyHttpDesitination.java where servers for
>> ea. port are created:
>>
>>   protected void retrieveEngine()
>>       throws GeneralSecurityException,
>>              IOException {
>>       if (serverEngineFactory == null) {
>>           return;
>>       }
>>       engine =
>>           serverEngineFactory.retrieveJettyHTTPServerEngine(
>> nurl.getPort());
>>       if (engine == null) {
>>           engine = serverEngineFactory.
>>               createJettyHTTPServerEngine(nurl.getHost(),
>> nurl.getPort(), nurl.getProtocol());
>>       }
>>
>> And port 8088 is already claimed by the HttpService registered by CXF:
>>
>> g! services (objectClass=*HttpService)
>> {org.osgi.service.http.HttpService, org.eclipse.equinox.http.
>> servlet.ExtendedHttpService}={service.description=Equinox Jetty-based
>> Http Service, service.vendor=Eclipse.org<http://Eclipse.org><http://
>> Eclipse.org>,
>> http.port=8088, service.id=64, service.bundleid=31, service.scope=bundle}
>> "Registered by bundle:" org.eclipse.equinox.http.
>> servlet_1.1.400.v20130418-1354
>> [31]
>> "Bundles using service"
>>   org.apache.cxf.cxf-rt-transports-http_3.1.6 [82]
>>   cxf-dosgi-ri-dsw-cxf_1.7.0 [138]
>>
>> The CXF-DOSGi documentation<http://cxf.apache.org/distributed-osgi-
>> reference.html> says about the org.apache.cxf.ws.httpservice.contex:
>> "When this property is specified, the OSGi HTTP Service is used to expose
>> the service, rather than a dedicated Jetty HTTP Server. This property
>> doesn't allow the specification of a port number, as this is provided by
>> the HTTP Service. The Distributed OSGi distributions come with Pax-Web, for
>> which configuration information can be found at
>> http://wiki.ops4j.org/display/paxweb/Configuration, however other OSGi
>> HTTP Service implementations are potentially configured differently.”
>>
>> When I try that, the service is bound to localhost:9000 instead of
>> 0.0.0.0:8088, which seems to happen in org.apache.cxf.dosgi.dsw.
>> handlers.PojoConfiguration.java:
>>
>>   private String getPojoAddress(Map<String, Object> sd, Class<?> iClass)
>> {
>>       String address = getClientAddress(sd);
>>       if (address != null) {
>>           return address;
>>       }
>>
>>       // If the property is not of type string this will cause an
>> ClassCastException which
>>       // will be propagated to the ExportRegistration exception property.
>>       Object port = sd.get(Constants.WS_PORT_PROPERTY);
>>       if (port == null) {
>>           port = "9000";
>>       }
>>
>>       address = "http://localhost:" + port + "/" +
>> iClass.getName().replace('.', '/');
>>       LOG.info<http://LOG.info>("Using a default address: " + address);
>>       return address;
>>   }
>>
>> I am trying to understand what I am missing for a while now, and every now
>> and again on a quiet Fri. afternoon (…) I take another stab at it, but I am
>> not getting much further.
>>
>> FWIW… the CXF servlet IS registered under the port defined by
>> org.osgi.service.http.port.
>>
>> This is all based on
>> CXF: 3.1.6 and CXF-DOSGi: 1.7.0
>> Java 8
>> Eclipse Equinox 3.10.2
>>
>> I checked the release notes for 1.8.0 but didn’t see anything related to
>> this issue.
>>
>> Any suggestions or pointers in the right directions would be greatly
>> appreciated.
>>
>>
>> Thanks,
>>
>> Erwin
>> Erwin Hogeweg
>> CTO
>> 3690 Airport Road
>> Boca Raton, FL 33431
>> P. +1 (954) 556-6565
>> M. +1 (561) 306-7395
>> F. +1 (561) 948-2730
>> [Seecago]<http://www.seecago.com>
>>
>>
>>
>>
>> --
>> --
>> Christian Schneider
>> http://www.liquid-reality.de
>> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e
>> 46&URL=http%3a%2f%2fwww.liquid-reality.de>
>>
>> Open Source Architect
>> http://www.talend.com
>> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e
>> 46&URL=http%3a%2f%2fwww.talend.com>
>>
>> Erwin Hogeweg
>> CTO
>> 3690 Airport Road
>> Boca Raton, FL 33431
>> P. +1 (954) 556-6565
>> M. +1 (561) 306-7395
>> F. +1 (561) 948-2730
>> [Seecago]<http://www.seecago.com>
>>
>
>
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de>
>
> Open Source Architect
> http://www.talend.com
> <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>
Erwin Hogeweg
CTO
3690 Airport Road
Boca Raton, FL 33431
P. +1 (954) 556-6565
M. +1 (561) 306-7395
F. +1 (561) 948-2730
[Seecago]<http://www.seecago.com>
Loading...