BlackBerryForums.com : Your Number One BlackBerry Community
     

»Sponsored Links


BlackBerryApps.com Best Sellers



View Poll Results: Please rate the post
Poor 0 0%
Passable 0 0%
Good 0 0%
Excellent 0 0%
Voters: 0. You may not vote on this poll

Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
nirmalsat Offline
Knows Where the Search Button Is
 
Posts: 17
Join Date: Aug 2009
Model: 8300
PIN: N/A
Carrier: Vodafone
Default Using KSoap2 for Blackberry Tutorial. The one without ambiguities!!! - 08-14-2009, 12:34 AM

Firstly this is my first post as a tutorial. So please don't care about short comings. I myself went through a lot of tutorials to develop a simple application on a blackberry device but sadly dint get much information. So this is for all those people who tried and dint get far and neither got much help..


I am using Eclipse ver 3.4.0( Apparently 3.4.1 is also supported but dint work for me), BlackBerry_JDE_PluginFull_1.0.0.67 , and ksoap2 which i am attaching here and simulators of ur choice (again only device software ver 4.3 and above)

If u r downloading the Ksoap2 library from elsewhere please make sure that it is preverified.

Step 1:
Create a new Blackberry Project.
After Creating a new project->Right click on the project->Project Properties-> Blackberry Project Properties-> Application->Project type->Library

Step 2:
Create a folder called "lib" at this new library project.

Step3:
Copy the ksoap2 preverified at this post to the lib folder. Right click on the file and select "Add to build path"

Step 4:Now Just build it once. Now your ready to use this is your application.

For your application.

Step5:In the Object explorer create a new project .

Step 6: Right click on the project -> Properties -> Java Build Path -> Libraries -> Add Jars... select Ksoap2.jar

Step 7: If you have noticed in previous posts many people have mentioned to add the created library to the project dependencies.. But there is no such option in Eclipse. It is only there if you use Blackberry JDE and yu are better off not using it in case you dont have any experience in Java cos it simply isnt worth it.


what you need to do here is right click on the project and there will be an option to add Project references. Click on it and it will contain the previous library project that you created. (P.S. You wont find it if its not in the same workspace). Check it and give add.

Thats it . Your done. You can go ahead and use the library. It will work like a charm..

Post back for Queries. All suggestions and criticisms welcome..Happy Coding!!!

P.S.
The preverified file and sample code that i have attached was taken from a previous post by Sickned.. I thank him for helping me get started.


And this is some sample code to access a .Net web service that i got from another post by Jackerlinn..
I thank hims for his post as well..
Code:
Below is simple code to call a .Net web service:

code extract from java file:
String serviceUrl = "<url to web service>l";
String serviceNamespace = "h t t p : / / tempuri . org /";
String soapAction = "h t t p : / / tempuri.org / HelloWorld";

SoapObject rpc = new SoapObject(serviceNamespace, "HelloWorld");

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

envelope.bodyOut = rpc;
envelope.dotNet = true;
envelope.encodingStyle = SoapSerializationEnvelope.XSD;

HttpTransport ht = new HttpTransport(serviceUrl);
ht.debug = true;

try
{
ht.call(soapAction, envelope);

String result = (envelope.getResult()).toString();


}
catch(org.xmlpull.v1.XmlPullParserException ex2){

}
catch(Exception ex){
String bah = ex.toString();

}


Code Extract from .Net web Service
namespace TestService
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "h t t p : / / tempuri . org /")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{

[WebMethod]
public string HelloWorld()
{
return "Hello World" + System.DateTime.Now.ToString();
}
}
}
Attached Files
File Type: zip Ksoap2LibPrev_and_sample_code.zip (42.8 KB, 67 views)

Last edited by nirmalsat : 08-14-2009 at 12:43 AM. Reason: Added Sample code
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
zergcow Offline
New Member
 
Posts: 1
Join Date: Aug 2009
Model: 8830
PIN: N/A
Carrier: Sprint
Default 08-18-2009, 05:24 PM

ok well I am having problems.

Step 1: No problem
Step 2: do I right click on the project and select New>Folder then name it lib?
Step 3: what is this ksoap2 preverified? do you mean ksaop2demo.java? and when i right click i don't have the option to add it to the build path. could you clarify that? This step really throws me off.
Step 4: No Problem

Step 5: No Problem
Step 6: No Problem
Step 7: No Problem
   
Reply With Quote
  (#3 (permalink)) Old
nirmalsat Offline
Knows Where the Search Button Is
 
Posts: 17
Join Date: Aug 2009
Model: 8300
PIN: N/A
Carrier: Vodafone
Default 08-19-2009, 12:06 PM

hi,
For step 2 , yes you need to right click on the project and click new and then nam the folder as lib.

After this download the attachment given above. It will have two files in it. You could jus drag the file from windows and drop it in to the lib folder in eclipse directly into the pane.

Then right click on the added file and select build --> Add to build path.
   
Reply With Quote
  (#4 (permalink)) Old
diego2k Offline
New Member
 
Posts: 9
Join Date: Aug 2009
Model: 7100T
PIN: N/A
Carrier: asd
Default 08-23-2009, 05:37 AM

dont work .... "Error starting Class Module ksoap2-j2me-core-prec-212 not found"
step 1 to 6 done
what do you mean with step 7?
   
Reply With Quote
  (#5 (permalink)) Old
diego2k Offline
New Member
 
Posts: 9
Join Date: Aug 2009
Model: 7100T
PIN: N/A
Carrier: asd
Default 08-23-2009, 09:33 AM

this works:

h tt p :/ /craigagreen.com/index.php?/Blog/blackberry-and-net-webservice-tutorial-part-1.html]craigAgreen - BlackBerry and .NET Web Service Tutorial - Part 1
   
Reply With Quote
  (#6 (permalink)) Old
nirmalsat Offline
Knows Where the Search Button Is
 
Posts: 17
Join Date: Aug 2009
Model: 8300
PIN: N/A
Carrier: Vodafone
Default 08-23-2009, 12:17 PM

Wirelessly posted

Yes. I have seen the post that you have mentioned here. But mine should work as well. How did u add the library to the project.. Check the actual path of the Lib folder that you created. Does it contain the file??
   
Reply With Quote
  (#7 (permalink)) Old
Sujit Offline
New Member
 
Posts: 6
Join Date: Aug 2009
Model: 8300
PIN: N/A
Carrier: email
Angry problen in Ksoap - 10-21-2009, 08:57 AM

Hello i am sorry to ask you this but have you ever work on eclipse plug-in or not.If yes which version u r using.i don't get any bulid.......>add to build path option.
Thanks.

Last edited by Sujit : 10-21-2009 at 09:15 AM.
   
Reply With Quote
  (#8 (permalink)) Old
nirmalsat Offline
Knows Where the Search Button Is
 
Posts: 17
Join Date: Aug 2009
Model: 8300
PIN: N/A
Carrier: Vodafone
Default 10-21-2009, 11:18 AM

I am sorry if i misguided u Sujit.. Anyways the version of eclipse and the plugin have all been mentioned at the begining of the post , if u would just care to read it properly..
   
Reply With Quote
  (#9 (permalink)) Old
New Member
 
Posts: 3
Join Date: Nov 2009
Model: 9000
PIN: N/A
Carrier: DOCOMO
Default 11-18-2009, 08:07 PM

please, help me.
I followed your steps.
But In my Simulator, 9000_Docomo can not find the module.

my environment is that :
BlackBerry JDE Component Package 4.5.0
Eclipse Platform Version: 3.4.1

please...help..me..
   
Reply With Quote
  (#10 (permalink)) Old
nirmalsat Offline
Knows Where the Search Button Is
 
Posts: 17
Join Date: Aug 2009
Model: 8300
PIN: N/A
Carrier: Vodafone
Default 11-18-2009, 11:45 PM

Pls make ur question is clear.. Did u mean to say that it says cannot find module Ksoap2 preverified... If that is the case , its probably cos u ve not added the ksoap2.jar file properly.. Remove the folder and the jar and add it again.. Pls make sure that when u create the Lib folder , u add it to the project root.

Last edited by nirmalsat : 11-18-2009 at 11:46 PM. Reason: Typos
   
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2009 BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.