1

Hi All
I have used Odata4j to create Odata Service and deployed in tomcat. When i use Sesame Data Browser i can see a Table
(if i click on THREAD ) having header. My question what should be the url to see the same data in web-browser? I want to consume this in a service so want to know url.

If i type this in http://localhost:8888/OdataEx/example.svc browser i can see some XML

<?xml version="1.0" encoding="utf-8" ?> 
 <service xmlns="http://www.w3.org/2007/app" xml:base="http://localhost:8888/OdataEx/example.svc/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app">
 <workspace>
  <atom:title>Default</atom:title> 
 <collection href="Threads">
  <atom:title>Threads</atom:title> 
  </collection>
  </workspace>
  </service>


and Java code generating service is

public class ExampleProducerFactory implements ODataProducerFactory {
  public ODataProducer create(Properties properties) {
    InMemoryProducer producer = new InMemoryProducer("example");
    // expose this jvm's thread information (Thread instances) as an entity-set called "Threads"
    producer.register(Thread.class, Long.class, "Threads", new Func<Iterable<Thread>>() {
      public Iterable<Thread> apply() {
        ThreadGroup tg = Thread.currentThread().getThreadGroup();
        while (tg.getParent() != null)
          tg = tg.getParent();
        Thread[] threads = new Thread[50];
        int count = tg.enumerate(threads, true);
        return Enumerable.create(threads).take(count);
      }
    }, Funcs.method(Thread.class, Long.class, "getId"));
    return producer;
  }
}
Arvind
  • 1,207
  • 6
  • 27
  • 55

2 Answers2

2

To see a specific entity set just append the entity set name to the URL. For example:

The sample service URL is: http://services.odata.org/OData/OData.svc/

To see the Products entity set, go to: http://services.odata.org/OData/OData.svc/Products

Note that this is also described in the service document returned by the .svc directly. Each collection element has an href attribute which is a relative URL pointing to that collection.

Vitek Karas MSFT
  • 13,130
  • 1
  • 34
  • 30
2

If you want to see data from browser then just add entityset name after .svc. you can also put the query to see the filterd data

The sample service URL is: http://services.odata.org/OData/OData.svc/

http://services.odata.org/OData/OData.svc/entitynameset