BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-22-2008, 09:31 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Posts: 42
Post Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb **** BlackBerry and Ksoap2 Tutorial *****

Please Login to Remove!

I was very, very sick trying to make work the ksoap2's libraries at a BlackBerry app and now I get it, Im gonna make a tutorial for all the people at the forum that have the same problem I had.

Ive used Eclipse and the Blackberry JDE plugin.

First of all, download the ksoap2 library preverified. I've uploaded it in this post.

Then, follow the steps:

- Create a Blackberry library project in your workspace, Ksoap2. (Create a new project->Right click->Project Properties-> Blackberry Project Properties-> Application->Project type->Library
- Create a folder called "lib" at this new library project.
- Copy the ksoap2 preverified at this post to the lib folder. Right click at Eclipse and select "Add to build path".
- Right click on the project->Add file to Blackberry Project-> Select the ksoap2 jar from the "lib" folder.

Now, into your project, in which you wanna use ksoap, do the next:
- Right click on the project -> Properties -> Java Build Path -> Libraries -> Add Jars... select Ksoap2.jar (Project's jar NOT LIBRARY JAR).. ->Ok
- Right click on the project -> Properties -> BlackBerry Project Dependencies -> Select "Ksoap2".

WARNING!!
Sometimes when you add a new library or change something in the build path, you must repeat the last step, because this checkbox get unchecked.

Now, you're ready to write your code.

I've uploaded a simple code sample calling a web service.

I hope this could be useful.

Change: I've re-uploaded the file, because it looks like be corrupted.
Attached Files
File Type: zip Ksoap2LibPrev_and_sample_code.zip (42.8 KB, 4100 views)

Last edited by sickned : 11-19-2008 at 10:06 AM.
Offline  
Old 10-22-2008, 06:13 PM   #2 (permalink)
New Member
 
Join Date: Oct 2008
Model: 8100
PIN: N/A
Carrier: TELCEL
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by sickned View Post
I was very, very sick trying to make work the ksoap2's libraries at a BlackBerry app and now I get it, Im gonna make a tutorial for all the people at the forum that have the same problem I had.

Ive used Eclipse and the Blackberry JDE plugin.

First of all, download the ksoap2 library preverified. I've uploaded it in this post.

Then, follow the steps:

- Create a Blackberry library project in your workspace, Ksoap2.
- Create a folder called "lib" at this new library project.
- Copy the ksoap2 preverified to this post. Right click at Eclipse and select "Add to build path".

Now, into your project, in which you wanna use ksoap, do the next:
- Right click on the project -> Properties -> Java Build Path -> Libraries -> Add Jars... select Ksoap2.jar. ->Ok
- Right click on the project -> Properties -> BlackBerry Project Dependencies -> Select "Ksoap2".

WARNING!!
Sometimes when you add a new library or change something in the build path, you must repeat the last step, because this checkbox get unchecked.

Now, you're ready to write your code.

I've uploaded a simple code sample calling a web service.

I hope this could be useful.
Great Example, just what I needed and I think many people need right now!

Thanks for your contribution
Offline  
Old 10-27-2008, 09:07 AM   #3 (permalink)
New Member
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: telefonica
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default can't see the tag BB project dependencies

i followed the instructions, but i can't see the tag BlackBerry Project Dependencies. I'm using eclipse 3.4, jde 4.6 and your ksoap2 library.

Pls Help :(
Offline  
Old 11-13-2008, 09:59 PM   #4 (permalink)
New Member
 
Join Date: Feb 2008
Model: 8703e
PIN: N/A
Carrier: Rogers
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

great jobs!
Offline  
Old 11-19-2008, 03:33 AM   #5 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: Globe
Posts: 52
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I'm using ksoap2 library and i want to use the class HttpTransportBasicAuth.

I understand that this class is not included in the preverified core ksoap2 library provided above.

It is in a separate file called ksoap-extras-2.1.2.jar or something like that, that i downloaded from sourceforge.net

I want to use this class in order to authenticate the user trying to access the web service by providing a username and password. I tried to verify this library but it always fails.

Can somebody help me on what i should do? Please help!



Thanks,
Jaclyn
Offline  
Old 11-19-2008, 10:01 AM   #6 (permalink)
Knows Where the Search Button Is
 
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Posts: 42
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by jacytan View Post
Hi,

I'm using ksoap2 library and i want to use the class HttpTransportBasicAuth.

I understand that this class is not included in the preverified core ksoap2 library provided above.

It is in a separate file called ksoap-extras-2.1.2.jar or something like that, that i downloaded from sourceforge.net

I want to use this class in order to authenticate the user trying to access the web service by providing a username and password. I tried to verify this library but it always fails.

Can somebody help me on what i should do? Please help!



Thanks,
Jaclyn
Just open the JAR I posted with WinRar and add the HttpTransportBasicAuth.class on the right package. It worked for me!

Last edited by sickned : 11-19-2008 at 10:06 AM.
Offline  
Old 11-21-2008, 11:40 PM   #7 (permalink)
Thumbs Must Hurt
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: Globe
Posts: 52
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by sickned View Post
Just open the JAR I posted with WinRar and add the HttpTransportBasicAuth.class on the right package. It worked for me!
Thanks so much for the reply! it really helped!

I was able to run my application already!
Offline  
Old 11-25-2008, 04:31 PM   #8 (permalink)
New Member
 
Join Date: Nov 2008
Model: 8800
PIN: N/A
Carrier: att
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Still no luck

First of all, thanks for the tutorial and it gives us a starting point. I have been looking at this for a week now and I still can not get it to work. I can not see "Blackberry project dependencies" and "Add file to project" options. Am I doing something wrong?



Quote:
Originally Posted by sickned View Post
I was very, very sick trying to make work the ksoap2's libraries at a BlackBerry app and now I get it, Im gonna make a tutorial for all the people at the forum that have the same problem I had.

Ive used Eclipse and the Blackberry JDE plugin.

First of all, download the ksoap2 library preverified. I've uploaded it in this post.

Then, follow the steps:

- Create a Blackberry library project in your workspace, Ksoap2. (Create a new project->Right click->Project Properties-> Blackberry Project Properties-> Application->Project type->Library
- Create a folder called "lib" at this new library project.
- Copy the ksoap2 preverified at this post to the lib folder. Right click at Eclipse and select "Add to build path".
- Right click on the project->Add file to Blackberry Project-> Select the ksoap2 jar from the "lib" folder.

Now, into your project, in which you wanna use ksoap, do the next:
- Right click on the project -> Properties -> Java Build Path -> Libraries -> Add Jars... select Ksoap2.jar (Project's jar NOT LIBRARY JAR).. ->Ok
- Right click on the project -> Properties -> BlackBerry Project Dependencies -> Select "Ksoap2".

WARNING!!
Sometimes when you add a new library or change something in the build path, you must repeat the last step, because this checkbox get unchecked.

Now, you're ready to write your code.

I've uploaded a simple code sample calling a web service.

I hope this could be useful.

Change: I've re-uploaded the file, because it looks like be corrupted.
Offline  
Old 12-01-2008, 06:21 AM   #9 (permalink)
Knows Where the Search Button Is
 
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Posts: 42
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by bharath001 View Post
First of all, thanks for the tutorial and it gives us a starting point. I have been looking at this for a week now and I still can not get it to work. I can not see "Blackberry project dependencies" and "Add file to project" options. Am I doing something wrong?
Are you using Eclipse or JDE? This tutorial is for Eclipse, I dont know how to do some steps at JDE.
Offline  
Old 12-05-2008, 12:03 AM   #10 (permalink)
New Member
 
Join Date: Dec 2008
Model: 7100T
PIN: N/A
Carrier: nothing
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default hey sorry to say m new in this using Ksoap bt i have to do a project in this .

m using ksoap jar file and eclips bt cann't do that ...the library is not supported ...
could u explain me ...previously i have wrked on banking project so m totally blank in using ksoap with blackberry IDE ....

plz give me some detail of this .....i used eclips earlier bt can't understand how to relate IDE and eclips plugin .......thanks in advance
Offline  
Old 12-05-2008, 12:22 AM   #11 (permalink)
Thumbs Must Hurt
 
baran_khan's Avatar
 
Join Date: Apr 2008
Model: 9500
PIN: N/A
Carrier: Airtel
Posts: 110
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by mithleshdwivedi View Post
m using ksoap jar file and eclips bt cann't do that ...the library is not supported ...
could u explain me ...previously i have wrked on banking project so m totally blank in using ksoap with blackberry IDE ....

plz give me some detail of this .....i used eclips earlier bt can't understand how to relate IDE and eclips plugin .......thanks in advance
Please confirm if the jar u are using is ksoap or ksoap2. You need to have a preverified version of ksoap2 jar file.
__________________
Smart People ask for Help!!!
Offline  
Old 12-05-2008, 12:38 AM   #12 (permalink)
New Member
 
Join Date: Dec 2008
Model: 7100T
PIN: N/A
Carrier: nothing
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default hi

ksoap2-j2me-core-prev-2.1.2

sir m using ksoap2 preverified jar....kindly help
and thanks for ur post
Offline  
Old 12-05-2008, 12:40 AM   #13 (permalink)
Thumbs Must Hurt
 
baran_khan's Avatar
 
Join Date: Apr 2008
Model: 9500
PIN: N/A
Carrier: Airtel
Posts: 110
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by mithleshdwivedi View Post
ksoap2-j2me-core-prev-2.1.2

sir m using ksoap2 preverified jar....kindly help
and thanks for ur post
I have sent you an email with the basic environment configuration steps ..let me know if you need further assistance.
__________________
Smart People ask for Help!!!

Last edited by baran_khan : 12-05-2008 at 12:54 AM.
Offline  
Old 12-05-2008, 01:05 AM   #14 (permalink)
New Member
 
Join Date: Dec 2008
Model: 7100T
PIN: N/A
Carrier: nothing
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default hi

thanku sir yes m working in qbit systems in jaipur ...
m reading the link provided by u ..thanks once again sir
Offline  
Old 12-05-2008, 04:36 AM   #15 (permalink)
New Member
 
Join Date: Oct 2008
Model: 9000
PIN: N/A
Carrier: Smart
Posts: 14
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default KSOAP problem

i had tried KSOAP2 to run on a Blackberry JDE4.6 but it didnt work fine for me,

i have this code:



SoapObject myObject = new SoapObject("http:--ws.test.net", "stringConcat");
HttpTransport transport = new HttpTransport("http:--localhost: 8080-BlackberryWS-BlackberryService");

myObject.addProperty("fname", "my");
myObject.addProperty("lname", "test");

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

envelope.setOutputSoapObject(myObject);


transport.debug = true;

transport.call("stringConcat", envelope);

String data = envelope.getResponse().toString();

but
DataGramProtocol(ConnectionBase).recieve(DataGram) Source not found problem pops up upon Debug. and as i look at the variables this._connectionHandlerName = "httpc"
and this._name = //localhost:8080/BlackberryWS/BlackberryService;ConnectionHandler=httpc


but with KSOAP2 SE:

the code works fine changing

HttpTransport transport = new HttpTransport("http:--localhost: 8080/ BlackberryWS/ BlackberryService");

to

HttpTransportSE transport = new HttpTransportSE("http:--localhost:8080/BlackberryWS/BlackberryService");

meaning with blackberry it changes http to httpc.. how can i make it maintain in http?


can anybody help? please..
Offline  
Old 12-11-2008, 01:51 AM   #16 (permalink)
New Member
 
Join Date: Dec 2008
Model: 9500
PIN: N/A
Carrier: Verizon
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am running into the same problem with not seeing "Blackberry project dependencies" under the project options. Anybody have any ideas?
Offline  
Old 12-11-2008, 03:17 AM   #17 (permalink)
Thumbs Must Hurt
 
baran_khan's Avatar
 
Join Date: Apr 2008
Model: 9500
PIN: N/A
Carrier: Airtel
Posts: 110
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by manyguns View Post
I am running into the same problem with not seeing "Blackberry project dependencies" under the project options. Anybody have any ideas?
Under the blackberry Project Properties section, click on "Application" tab and change your project type to Library.
__________________
Smart People ask for Help!!!
Offline  
Old 12-11-2008, 08:40 AM   #18 (permalink)
New Member
 
Join Date: Dec 2008
Model: 9500
PIN: N/A
Carrier: Verizon
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by baran_khan View Post
Under the blackberry Project Properties section, click on "Application" tab and change your project type to Library.
I'm assuming you mean to do that for the project that I made as instructed by the tutorial and not for the actual project that shows the UI. I have done that. The problem is I do not see "Blackberry project dependencies" at all in the properties list for either of the projects. I see...
Resources
Blackberry Project Properties
Builders
Java Build Path
etc...
Offline  
Old 12-13-2008, 02:31 AM   #19 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Posts: 117
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default testing webservice on simulator

Hi All,
I have developed a client on BB using ksoap2.

I have tried using the MDS simulator along with the device simulator (as mentioned in some post), but whenever i send a request, i get the following Exception:

org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <{http://www.w3.org/2003/05/soap-envelope}soap:Envelope>@1:205 in java.io.InputStreamReader@2bdcc2b0)

I dunno whats going wrong or how to go about it. Please help.

I am developing using the following components:
BB OS: 4.1.0
JDE: 4.1.0
ksoap2: lib\ksoap2-j2me-core-prev-2.1.2.jar

PS: I can access it through http demo application, but not through my web service. I am pasting my code below:

Code:
    private String IPorHostname = "http://192.168.1.33";
    private String path = "/xyzs/service.asmx";
    public MXYZ_Main() {

        SoapObject request = new SoapObject("http://tempuri.org/", "DealerOutstanding");

        request.addProperty("dlr_code", "1177");
        System.out.println(request.toString());

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.bodyOut = request;
        envelope.dotNet = true;

        HttpTransport ht = new HttpTransport(IPorHostname + path);
        ht.debug = true;

        try {
            ht.call("", envelope);
            
            SoapObject result = (SoapObject) envelope.getResponse();
            
            System.out.println(result.toString());
            String str = result.getProperty("DealerOutstandingResult").toString();
           
            System.out.println("Soap: " + str);
        } catch (XmlPullParserException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        } catch (Exception ex) {
            System.out.println("ex " + ex.toString());
        }
__________________
Thanks
Meenal

Last edited by Meenal : 12-13-2008 at 03:26 AM.
Offline  
Old 12-13-2008, 05:35 AM   #20 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Posts: 117
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi all,
I have solved the above problem.
__________________
Thanks
Meenal

Last edited by Meenal : 12-13-2008 at 05:44 AM.
Offline  
Closed Thread


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-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.