1

我在 .NET 中编写了一个简单的 Web 服务,它返回一个字符串值。

[WebMethod]
    public string DeveloperInfo()
    {
        return "Chamara is the appliaction developer";
    }

我需要使用 J2ME 应用程序来使用它。以下是我使用的代码

if (displayable == ServiceForm) {
        if (command == exitCommand1) {
            // write pre-action user code here
            switchDisplayable(null, getTaskList());
            // write post-action user code here
        } else if (command == okCommand2) {
        try
        {
            new Thread(new Runnable()
          {
              public void run()
              {
         try {
                  service1.Service1_Stub service=new service1.Service1_Stub();

             String Info= service.DeveloperInfo().toString();
             txtService.setString(Info);
                // write post-action user code here
            } catch (Exception ex) {
                ex.printStackTrace();
            }
              }
          }).start();
        }catch (Exception e){System.out.println(e.toString());}

它给出了以下异常

java.lang.IllegalArgumentException
    at javax.microedition.lcdui.TextField.setChars(TextField.java:747)
    at javax.microedition.lcdui.TextField.setString(TextField.java:666)
    at com.sliit.j2me.tutorial.TaskList$1.run(TaskList.java:155)

我哪里错了?

4

1 回答 1

3

似乎 TextBox 约束失败了。
前任。文本设置为接受输入数字,您尝试在其中设置字母。检查它,如果不是这种情况,则发布信息的包含。

于 2010-08-24T08:21:33.110 回答