Hi,

I am having a problem with using the 3650 emulator for running Web services clients using the kSOAP HttpTransport class. This appears to be emulator specific because my code works fine on the ktoolbar default color phone.

I have a basic Web service that currently just takes 2 input strings, does some processing, and returns a string. This works fine and i managed to get a mobile client to connect to it. The client code is below. I get

java.io.IOException: Status = -21
at org.ksoap.transport.HttpTransport.call(+417)
at org.ksoap.transport.HttpTransport.call(+12)
at MobileClient$ConnectionManager.run(+72)

when i try to run the client.

Any ideas. HttpTransport appears to use HTTP POST. I see this has been a problem for others. I have followed various suggestions regarding a separate thread for the HTPConnection and closing connections. The thread issue was important and allowed the code to work in the default emulator but so far nothing seems to get it to work in the series 60 emulators.

public class MobileClient extends MIDlet implements CommandListener {

Form mainForm = new Form ("MobileService");
TextField.ANY);
StringItem resultItem = new StringItem ("","");
Command getCommand = new Command ("Get", Command.SCREEN, 1);


public MobileClient () {

mainForm.append(new StringItem(null, "DVD Service Client"));
mainForm.append (resultItem);
mainForm.addCommand (getCommand);
mainForm.setCommandListener (this);
}

public void startApp () {

Display.getDisplay (this).setCurrent (mainForm);
}

public void pauseApp () {
}

public void destroyApp (boolean unconditional) {
}

public void commandAction (Command c, Displayable d) {

try {
ConnectionManager connectionManager = new ConnectionManager();
connectionManager.start();

}
catch (Exception e) {
e.printStackTrace ();
resultItem.setLabel ("Error:");
resultItem.setText (e.toString ());
}
}

/** for me4se */

public static void main (String [] argv) {

new MobileClient ().startApp ();
}


// The call to the server must be handled in a separate thread to prevent deadlock.
// may not be the best way, but it works.
class ConnectionManager extends Thread {

HttpTransport httpTransport = null;

public void run() {

try
{
SoapObject rpc = new SoapObject ("urn:StreamingMultimedia", "getAudioURI");
rpc.addProperty("in0", "yes");
rpc.addProperty("in1", "wav");
httpTransport = new HttpTransport("http://localhost:8080/axis/services/StreamingMultimedia", "urn:StreamingMultimedia#getAudioURI");
resultItem.setText(""+httpTransport.call(rpc));
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
finally {

httpTransport.reset();
}

}
}
}