One Star

Hide a Web service in karaf

Hi !
Is it possible to provide a Web service in Karaf but to hide it from beeing displayed when the url "http://xxx.xxx.xxx.xxx:8040/services/" is called ?
Thanks !
7 REPLIES
Employee

Re: Hide a Web service in karaf

Hi
it is possible at Apache CXF level, adding a "org.apache.cxf.endpoint.private" contextual property to JAXWS or JAXRS endpoint will work.
Can you modify a bundle Blueprint context ?
Cheers, Sergey
One Star

Re: Hide a Web service in karaf

Hi Sergey,
Thank you for responding.
I am using the Talend studio... So I dont think that I can modify any file easily...
What I can do is to add or modifiy files in Karaf.
Regards.
Employee

Re: Hide a Web service in karaf

Hi,
The easiest workaround is to get the bundle (jar) created by Studio, unjar it, modify a context (file is named service.xml or beans.xml) in OSGI-INF/blueprint and jar it back and deploy a bundle again. You'd modify a JAXWS or JAXRS endpoint declaration by adding the property like this:
<jaxrs:server addres="/someaddress">
<jaxrsSmiley Tongueroperties>
<entry key="org.apache.cxf.endpoint.private" value="true"/>
</jaxrsSmiley Tongueroperties>
</jaxrs:server>
or do the same for jaxws:endpoint.
Actually the simpler option is:
etc/org.apache.cxf.osgi.cfg file may have CXF specific properties set.
So what you can do is set "org.apache.cxf.servlet.hide-service-list-page" to true, but note a user will probably see the error when accessing the page...
"org.apache.cxf.servlet.service-list-page-authenticate" property is also available - so may be you can 'open' the page to admins only, I haven't tried it though,
HTH, Sergey
One Star

Re: Hide a Web service in karaf

Hi Sergey !
I tried the second solution. So I have edited the "etc/org.apache.cxf.osgi.cfg" file.
I have added this line : org.apache.cxf.servlet.service-list-page-authenticate=true
I have restarted the karaf runtime, but when I try to display the page http://localhost:8040/services/ I still can access it... Maybe the value "true" is no correct...
In fact, displaying this page is not a problem : what I really want is to hide only one Web service to be listed in this page... A specific one... Do you think that it is possible ?
Thanks !
One Star

Re: Hide a Web service in karaf

The option org.apache.cxf.servlet.hide-service-list-page=true works : I can't display the exposed Web services. Good thing. Now, I want to hide only one of them Smiley Happy
Regards
Employee

Re: Hide a Web service in karaf

The authenticate property was added recently, probably not supported yet in your version of the container.
Re the individual selection: at the moment only the trick with the bundle jar will do.
I've also created an enhancement request:
https://jira.talendforge.org/browse/TESB-13575
Cheers, Sergey
One Star

Re: Hide a Web service in karaf

Thank you so much Sergey !