Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android-ApacheCommons库&;Exchange Web服务管理API_Java_Android_Exchangewebservices_Apache Commons Httpclient_Ewsjavaapi - Fatal编程技术网

Java Android-ApacheCommons库&;Exchange Web服务管理API

Java Android-ApacheCommons库&;Exchange Web服务管理API,java,android,exchangewebservices,apache-commons-httpclient,ewsjavaapi,Java,Android,Exchangewebservices,Apache Commons Httpclient,Ewsjavaapi,我已经在用Java尝试exchange web服务了。它运行良好。它已正确发送电子邮件或获取电子邮件 我的java代码如下所示: public static void main(String[] args) { try { Locale.setDefault(Locale.ENGLISH); ExchangeService service = new ExchangeService(); WebCredentials webCredenti

我已经在用Java尝试exchange web服务了。它运行良好。它已正确发送电子邮件或获取电子邮件

我的java代码如下所示:

public static void main(String[] args) {
    try {
        Locale.setDefault(Locale.ENGLISH);
        ExchangeService service = new ExchangeService();
        WebCredentials webCredentials = new WebCredentials("asdasd@asasd.onmicrosoft.com", "asdasdasd");
        URI url = new URI("https://asdasd802.outlook.com/ews/Exchange.asmx");
        service.setCredentials(webCredentials);
        service.setUrl(url);

        System.out.println(service.getRequestedServerVersion());

        msg.setSubject("Hello world!"); 
        msg.setBody(MessageBody.getMessageBodyFromText("Sent using the EWS Managed API."));
        msg.getToRecipients().add("asdasd@gmail.com");
        msg.send();

    } catch (Exception ex) {
        ex.printStackTrace();
        //System.out.println(ex.toString());
    }

}
当我在android中使用以下代码尝试此操作时:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_layout);
    Button b = (Button) findViewById(R.id.button1);
    b.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {

            Locale.setDefault(Locale.ENGLISH);
            try {
                ExchangeService service = new ExchangeService();
                WebCredentials webCredentials = new WebCredentials(
                        "asdasd@asdasd.onmicrosoft.com",
                        "asdasd");
                URI url = new URI("https://asdasd.outlook.com/ews/Exchange.asmx");
                service.setCredentials(webCredentials);
                service.setUrl(url);

                EmailMessage msg= new EmailMessage(service);
                msg.setSubject("Hello world!");
                msg.setBody(MessageBody.getMessageBodyFromText
                           ("Sent using the EWS Managed API."));
                msg.getToRecipients().add("asdasd@gmail.com");
                msg.send();

            } catch (Exception ex) {
                //ex.printStackTrace();
                System.out.println(ex.toString());
            }
        }
    });
}
当点击按钮时,我发现一些错误

这是来自控制台的消息:

[2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.httpclient.HttpMethodBase$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.LogFactoryImpl$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.LogFactoryImpl$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.LogFactoryImpl$3) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.SimpleLog$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.impl.WeakHashtable$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$1) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$2) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$3) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$4) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$5) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. [2011-12-15 17:06:25 - MobileApplication1] Dx warning: Ignoring InnerClasses attribute for an anonymous inner class (org.apache.commons.logging.LogFactory$6) that doesn't come with an associated EnclosingMethod attribute. This class was probably produced by a compiler that did not target the modern .class file format. The recommended solution is to recompile the class from source, using an up-to-date compiler and without specifying any "-target" type options. The consequence of ignoring this warning is that reflective operations on this class will incorrectly indicate that it is *not* an inner class. Toggle HighlightingOpen in New WindowSelect All [2011-12-15 17:06:25-MobileApplication1]Dx警告:忽略匿名内部类的InnerClasses属性 (org.apache.commons.httpclient.HttpMethodBase$1)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它*不是*内部类。 [2011-12-15 17:06:25-MobileApplication1]Dx警告:忽略匿名内部类的InnerClasses属性 (org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它*不是*内部类。 [2011-12-15 17:06:25-MobileApplication1]Dx警告:忽略匿名内部类的InnerClasses属性 (org.apache.commons.logging.impl.LogFactoryImpl$1)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它*不是*内部类。 [2011-12-15 17:06:25-MobileApplication1]Dx警告:忽略匿名内部类的InnerClasses属性 (org.apache.commons.logging.impl.LogFactoryImpl$2)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它*不是*内部类。 [2011-12-15 17:06:25-MobileApplication1]Dx警告:忽略匿名内部类的InnerClasses属性 (org.apache.commons.logging.impl.LogFactoryImpl$3)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它*不是*内部类。 [2011-12-15 17:06:25-MobileApplication1]Dx警告:忽略匿名内部类的InnerClasses属性 (org.apache.commons.logging.impl.SimpleLog$1)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它*不是*内部类。 [2011-12-15 17:06:25-MobileApplication1]Dx警告:忽略匿名内部类的InnerClasses属性 (org.apache.commons.logging.impl.WeakHashtable$1)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它*不是*内部类。 [2011-12-15 17:06:25-MobileApplication1]Dx警告:忽略匿名内部类的InnerClasses属性 (org.apache.commons.logging.LogFactory$1)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它*不是*内部类。 [2011-12-15 17:06:25-MobileApplication1]Dx警告:忽略匿名内部类的InnerClasses属性 (org.apache.commons.logging.LogFactory$2)没有附带 关联的EnclosingMethod属性。这个类可能是由一个 未以现代.class文件格式为目标的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译该类 并且不指定任何“-target”类型选项。忽视的后果 此警告表示此类上的反射操作将不正确 指示它*不是*内部类。 [2011-12-15 17:06:25-MobileApplication1]Dx警告:忽略Inne 09-21 09:10:17.039: E/AndroidRuntime(4126): FATAL EXCEPTION: main 09-21 09:10:17.039: E/AndroidRuntime(4126): java.lang.VerifyError: microsoft.exchange.webservices.data.EwsServiceXmlWriter 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ServiceRequestBase.emit(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ServiceRequestBase.validateAndEmitRequest(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ExchangeService.internalCreateItems(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.ExchangeService.createItem(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.Item.internalCreate(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.EmailMessage.internalSend(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at microsoft.exchange.webservices.data.EmailMessage.send(Unknown Source) 09-21 09:10:17.039: E/AndroidRuntime(4126): at com.MobileApplication1.android.MainScreenActivity$1.onClick(MainScreenActivity.java:60) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.view.View.performClick(View.java:2485) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.view.View$PerformClick.run(View.java:9080) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.os.Handler.handleCallback(Handler.java:587) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.os.Handler.dispatchMessage(Handler.java:92) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.os.Looper.loop(Looper.java:123) 09-21 09:10:17.039: E/AndroidRuntime(4126): at android.app.ActivityThread.main(ActivityThread.java:3687) 09-21 09:10:17.039: E/AndroidRuntime(4126): at java.lang.reflect.Method.invokeNative(Native Method) 09-21 09:10:17.039: E/AndroidRuntime(4126): at java.lang.reflect.Method.invoke(Method.java:507) 09-21 09:10:17.039: E/AndroidRuntime(4126): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867) 09-21 09:10:17.039: E/AndroidRuntime(4126): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625) 09-21 09:10:17.039: E/AndroidRuntime(4126): at dalvik.system.NativeStart.main(Native Method) Toggle HighlightingOpen in New WindowSelect All