when i am using this code it gives error

大憨熊 提交于 2019-12-02 14:14:39

问题


public ContactEntry createContact(String username)throws IllegalArgumentException {
        // Create the entry to insert
        ContactsService myService = new ContactsService("exampleCo-exampleApp-1");
        try {
            myService.setUserCredentials("abc@in.gappsdemo.in", "xyz@123");
        } catch (AuthenticationException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        String name = "neha'sContact";
        String notes = "this is some notes from gdata API client";

        ContactEntry contact = new ContactEntry();
        contact.setTitle(new PlainTextConstruct(name));
        contact.setContent(new PlainTextConstruct(notes));

        Email primaryMail = new Email();
        primaryMail.setAddress("demo@in.gappsdemo.in");
        primaryMail.setRel("http://schemas.google.com/g/2005#home");
        primaryMail.setPrimary(true);
        contact.addEmailAddress(primaryMail);

        Email secondaryMail = new Email();
        secondaryMail.setAddress("demo@in.gappsdemo.in");
        secondaryMail.setRel("http://schemas.google.com/g/2005#work");
        secondaryMail.setPrimary(false);
        contact.addEmailAddress(secondaryMail);

        ExtendedProperty favouriteFlower = new ExtendedProperty();
        favouriteFlower.setName("favourite flower");
        favouriteFlower.setValue("daisy");
        contact.addExtendedProperty(favouriteFlower);

        ExtendedProperty sportsProperty = new ExtendedProperty();
        sportsProperty.setName("sports");
        XmlBlob sportKinds = new XmlBlob();
        sportKinds.setBlob(new String("<dance><salsa/><ballroom dancing/><dance/>"));
        sportsProperty.setXmlBlob(sportKinds);
        contact.addExtendedProperty(sportsProperty);
        System.out.println(contact);

        // Ask the service to insert the new entry
        try{
            System.out.println("Inside try  Block:");
            URL postUrl = new URL("https://www.google.com/m8/feeds/contacts/demo@in.gappsdemo.in/full");
            System.out.println("Inside try  Block1:");
            return myService.insert(postUrl, contact);



        }
        catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }
        return contact;
    }

when i am using this code it gives the following error : [ERROR] [simplerpc] - Line 9: No source code is available for type com.google.gdata.data.contacts.ContactEntry; did you forget to inherit a required module?


回答1:


You can not use server side code in GWT directly. As GWT will not be able to generate JavaScript for com.google.gdata.data.contacts.ContactEntry this is giving you above error.



来源:https://stackoverflow.com/questions/6248373/when-i-am-using-this-code-it-gives-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!