10-07-2010 01:43 AM
hi.. i m very much new to ksoap2 concept.. i want to connect and display the contents from a dot net web service.. can any one help? any reference ?
10-07-2010 01:56 AM
This is the some idead to access a webservice.
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import org.ksoap2.*;
import org.ksoap2.serialization.*;
import org.ksoap2.transport.*;
import net.rim.device.api.crypto.certificate.x509.*;
import java.util.Date;
import net.rim.device.api.i18n.SimpleDateFormat;
import net.rim.device.api.i18n.DateFormat;
class SampleScreen extends MainScreen implements FieldChangeListener
{
ButtonField bf;
RichTextField txt=new RichTextField();
public SampleScreen()
{
bf=new ButtonField("Click");
bf.setChangeListener(this);
add(bf);
}
public void webservice()
{
add(new RichTextField(":Start Process:"));
String serviceurl = "http://www.deeptraining.com/webservices/weather.a? smx";
String serviceNamespace = "http://litwinconsulting.com/webservices/";
String soapAction = "http://litwinconsulting.com/GetWeathe?r";
SoapObject rpc = new SoapObject(serviceNamespace,"GetWeather");
rpc.addProperty("GetWeather","Canada");
SoapSerializationEnvelope envlope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envlope.bodyOut=rpc;
envlope.dotNet=true;
envlope.encodingStyle=SoapSerializationEnvelope.XS D;
rpc.addProperty("Message",(new Date()).toString());
HttpTransport ht = new HttpTransport(serviceurl);
ht.debug = true;
String result="";
try
{
ht.call(soapAction, envlope);
result = (envlope.getResponse()).toString();
}catch(Exception e){result=e.toString();}
//((SampleScreen)this.getActiveScreen()).setScreen ?Test(result);
add(new RichTextField("==->"+result));
}
public void fieldChanged(Field f,int Context)
{
if(f==bf)
{
webservice();
}
}
}
Not the Actuall code but an Idea.T
Thanks
--------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.
10-07-2010 02:08 AM
thanks for replying nitin.. there 3 strings are declared.. one is web service url and i can able to understand tat.. wats the remaining 2 url.. may be my doubt is silly.. but now only i m trying to learn this.. dont mistake..
10-07-2010 02:12 AM
Hello Dude,
Here are some links that will guide you in the right direction:
http://www.craigagreen.com/index.php?/Blog/blackbe
Hope this will help you. Could you also explain what you are struggling with ?
10-07-2010 02:17 AM
hi. more over, first i tried to create ksoap library application.. i failed in tat also.. when i see to my project properties, i dint find any options like "Blackberry Project Properties" to assign it as library.. as said in these links..
-----
http://www.craigagreen.com/index.php?/Blog/blackbe
-----
i already raised this problem in another thread also..
http://supportforums.blackberry.com/t5/Java-Develo
10-07-2010 02:19 AM
Second url is for NameSpace of the dotNet webservice.
And third url is for the webservice method name.
I think now should be clear.
--------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.
10-07-2010 02:34 AM
k nitin.. thanks.. can u please solve my previous issue.. i dint find the "Blackberry Project Properties" to select it as library.. wats the problem here..
10-07-2010 02:45 AM
What are you using for Coding JDE or Eclipse.
If you are using JDE then I can solve b'coz i am using JDE 5.0;
--------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.
10-07-2010 02:48 AM
Right click on you project,
Click properties
Click Blackberry Project
Click Application Describer
Once that opens then choose library from the "application type" dropdown
Alternatively you should have the application Describer in you project's package explorer.
Hope this helps
10-07-2010 02:59 AM
yes wesley.. thanks.. ur rite.. it worked now.. but now i m strucked here
"Error starting my_project:module 'ksoap2-j2me-core-prev-2.1.2' not found"![]()