View Single Post
Old 09-03-2007, 05:58 AM   #18
sudhirispl
New Member
 
Join Date: Aug 2007
Model: 8800
PIN: N/A
Carrier: Vodafone
Posts: 14
Default

Quote:
Originally Posted by jfisher View Post


i have used ksoap2-j2me-core-2.1.0.jar in my app for call .net web services.but i didn't get any output from web services.

my code is

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.system.*;

import java.util.*;

import org.ksoap2.*;
import org.ksoap2.serialization.*;
import org.ksoap2.transport.*;

public class StockQuoteDemo extends UiApplication
{
public static void main (String[] args)
{
StockQuoteDemo theApp = new StockQuoteDemo ();
theApp.enterEventDispatcher ();
}

public StockQuoteDemo ()
{
pushScreen (new StockQuoteScreen ());
doSOAP();
}

final class StockQuoteScreen extends MainScreen
{
LabelField resultItem;
BasicEditField symbolField;
ButtonField bf;

public StockQuoteScreen ()
{
LabelField title = new LabelField ("StockQuote Sample", LabelField.ELLIPSIS|LabelField.USE_ALL_WIDTH);
setTitle (title);
symbolField = new BasicEditField ("Stock Symbol ", "ORCL", 4,BasicEditField.EDITABLE|BasicEditField.FILTER_UP PERCASE);
resultItem = new LabelField ("Stock Price", LabelField.ELLIPSIS|LabelField.USE_ALL_WIDTH);
bf = new ButtonField ("Get price", Field.FOCUSABLE);

add (symbolField);
add (resultItem);
add (bf);
}

public boolean onClose ()
{
Dialog.alert ("Goodbye!");
System.exit (0);
return true;
}
}
public void doSOAP()
{
try
{
System.out.println("i am here 1");

SoapObject rpc = new SoapObject ("test/HelloWorld", "test/HelloWorld");

//rpc.addProperty("userstr","itnwc");

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = rpc;
envelope.dotNet = true;
envelope.encodingStyle = SoapSerializationEnvelope.ENC;

HttpTransport ht = new HttpTransport ("http://192.168.15.107/WebSite/Service.asmx");
ht.debug = true;
System.out.println("i am here 2");
ht.call("test/HelloWorld",envelope);
System.out.println("i am here 3");
System.out.println("ok:" + envelope.toString());
System.out.println("Result of BB:" + envelope.getResult());

}

catch (Exception e)
{
System.out.println("i am here in catch");
e.printStackTrace ();

}
}
}
================================================
my output is

i am here 1
i am here 2


i am here in catch
No stack trace

what should do.plz reply the answer.thanks in advance

Last edited by sudhirispl; 09-03-2007 at 06:02 AM..
Offline   Reply With Quote