vestabu / odata4j

Automatically exported from code.google.com/p/odata4j
0 stars 0 forks source link

ODataConsumer.create fails in OpenOffice enviornment #89

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Created ODataConsumer and added OClientBehaviors.basicAuth()
2. Queried on the collection with filter
3. Works fine from eclipse enviornment but fails from OpenOffice enviornment.
4. Used the OpenOffice eclipse plugin to create the addon for the openoffice 
deployment.
Kindly refer the attached screenshot for details.

The following code works fine from eclipse environment:

import javax.ws.rs.Consumes;

import org.odata4j.consumer.ODataConsumer;
import org.odata4j.core.OClientBehavior;
import org.odata4j.core.OClientBehaviors;
import org.odata4j.core.ODataConstants;
import org.odata4j.core.OEntity;

@Consumes(ODataConstants.APPLICATION_ATOM_XML)
public class OData4jValidator {

    public static void main(String[] args) {

        String urlString = "http://ldcigkd.yyy.xxx.corp:50033/zzz/opu/sdata/IWCNT/CUSTOMER/";

        OClientBehavior basicAuth = OClientBehaviors.basicAuth("user", "pwd");

        OClientBehavior[] ocb = { basicAuth };
        ODataConsumer consumer = ODataConsumer.create(urlString, ocb);

        for (OEntity customer : consumer.getEntities("CustomerCollection").filter("CityName eq 'Bangalore'").execute()) {
            System.out.println(customer.getProperty("CustomerID").getValue());
        }

    }

}

But the same code fails from Open Office environment.

What is the expected output? What do you see instead?
See the screenshot

What version of the product are you using? On what operating system?
Odata4j-bundle jar, java 1.6, Windows 7 64 bit, OpenOffice v3.

Please provide any additional information below.

Original issue reported on code.google.com by soun...@gmail.com on 7 Nov 2011 at 12:30

Attachments:

GoogleCodeExporter commented 8 years ago
It seems that the OpenOffice environment is different with regards to how the 
JAX-RS RuntimeDelegate is instantiated. The JAX-RS specification contains some 
information on how the configuration works (chapter 7). Maybe you can try to 
set the Jersey RuntimeDelegate implementation "by hand" as a workaround to see 
if it works then, e.g. call the static setInstance method from within your 
code. Another interesting thing would be to have a look at the classpath and 
compare it to the one from the working environment.

Original comment by philipp.sebastian.thun on 9 Nov 2011 at 12:37

GoogleCodeExporter commented 8 years ago
Hi Philipp,

Thanks for looking into the issue.
I added the following code before invoking ODataConsumer.create

import javax.ws.rs.ext.RuntimeDelegate;
import com.sun.jersey.server.impl.provider.RuntimeDelegateImpl;

RuntimeDelegate.setInstance(new RuntimeDelegateImpl());

But this did not solve the issue. I still get the same error as in previous 
attached screenshot. 
Also the open office classpath is same as the working ebviornment. Kindly refer 
the screenshot "openoffice_classpath.jpg" attached.

Thanks & Regards,
Sounak Basu

Original comment by soun...@gmail.com on 9 Nov 2011 at 8:04

Attachments: