views:

23

answers:

1

I have wrote a simple web service in .NET which return a string value.

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

I need to consume it using a J2ME application.following is the code i have used

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());}

It gives the following Exception

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)

can any one plz tell me where i have got wrong???

+1  A: 

It seems TextBox constraint fails.
Ex. The Text is set to take input numbers and you try to set alphabets into it. check it and if it isn't the case then post the contain of Info.

org.life.java
Thanks...textBox maximum size is 32.webservice return string have more than 32 characters..
chamara
One more thing,can u tell me what is the control that i can use to include more than 32 characters.
chamara
From your code it seems you are using NetBeans, So you can set the max. size for textField from UI. its not 32 only. you can set it.
org.life.java