1

I have created a very basic producer example using OData4J (JPAProducer) Now I can see the info about schema on browser normal. However the excel 2013 data connection wizard showing error. I tried Excel with http://services.odata.org/V3/OData/OData.svc/ worked fine. What am I doing wrong.

Any help would be greatly appreciated.

 public static JPAProducer createProducer() {
Map properties = new HashMap();
    properties.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, DatabaseUtil.getDataSource());
    javax.persistence.EntityManagerFactory factory = Persistence.createEntityManagerFactory("persistentunit",
            properties);
JPAProducer producer = new JPAProducer(factory, "", 50);
     return producer;
    }


public static void startService() {
        DefaultODataProducerProvider.setInstance(createProducer());
        hostODataServer("http://localhost:8887/JPAProducerExample.svc/");
    }

    public static void main(String[] args) {
        startService();

    }


    private static void hostODataServer(String baseUri) {
        ODataServer server = null;
        try {
            server = startODataServer(baseUri);

        } catch (Exception e) {
            System.out.print(e.getLocalizedMessage());
        } 
    }


    private static ODataServer startODataServer(String baseUri) {
        return createODataServer(baseUri).start();
    }


    private static ODataServer createODataServer(String baseUri) {
        return new ODataJerseyServer(baseUri, ODataApplication.class, RootApplication.class);
    }
Karan
  • 26
  • 1
  • Managed to understand what is going wrong. I would say Install fiddler on the machine where excel is used to fetch odata feed. Now first try to fetch the via browser and have a look at the header parameters in fiddler and second time try to fetch odata feed via Excel(which is not working in my case) and then compare the header parameters. This will explain you the reason. Basically you would need to intercept incoming excel odata request and change few parameters to make it work. – Karan Mar 05 '14 at 06:36

0 Answers0