Previous topic  Top  Next topic  Print this Topic

Extensions Directory for Deploying a Web Service


To add a Web service to OntoBroker, you simply implement a normal JAX-WS webservice class, which implements the marker interface OntoBrokerService, and publish it as an OntoBrokerService to OSGI.

package com.ontoprise.ontobroker.webservice;



* Marker interface for web services deployed together with OntoBroker



public interface OntoBrokerService {


The skeleton of your Web service class will look like this:

package com.acme.mywebservice


@javax.jws.WebService(endpointInterface ="com.acme.mywebservice.MyItf")

public class MyService implements MyItf, OntoBrokerService {

  private OntologyManager _ontologyManager;


  protected void bindOntoBrokerServiceManager(OntoBrokerServiceManager manager) {

      _ontologyManager = manager.getOntologyManager();



  //  web service operations are added here


Normally a Web service deployed in OntoBroker needs access to the ontologies or the reasoner. For this purpose, your webservice class should reference the OntoBrokerServiceManager service and remember the OntologyManager on the bind operation. Additionally you need to specify the relative address for publishing the Web service endpoint.

<?xml version="1.0" encoding="UTF-8"?>

<scr:component xmlns:scr="" name="com.acme.mywebservice">

  <implementation class="com.acme.mywebservice.MySvc"/>

  <reference cardinality="1..1" interface="com.ontoprise.ontobroker.webservice.OntoBrokerServiceManager" name="OntoBrokerServiceManager" policy="static" bind="bindOntoBrokerServiceManager" />

    <provide interface="com.ontoprise.ontobroker.webservice.OntoBrokerService"/>


  <property name="address" type="String" value="/myservice"/>


The rest is similar to the above description for the built-in bundle.