BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-22-2008, 09:31 AM   #1
sickned
Knows Where the Search Button Is
 
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Posts: 42
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, 4116 views)

Last edited by sickned; 11-19-2008 at 11:06 AM..
Offline  
Old 10-22-2008, 06:13 PM   #2
ArthurKnight
New Member
 
Join Date: Oct 2008
Model: 8100
PIN: N/A
Carrier: TELCEL
Posts: 11
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
pmardones
New Member
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: telefonica
Posts: 4
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, 10:59 PM   #4
bsecurity
New Member
 
Join Date: Feb 2008
Model: 8703e
PIN: N/A
Carrier: Rogers
Posts: 5
Default

great jobs!
Offline  
Old 11-19-2008, 04:33 AM   #5
jacytan
Thumbs Must Hurt
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: Globe
Posts: 52
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, 11:01 AM   #6
sickned
Knows Where the Search Button Is
 
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Posts: 42
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 11:06 AM..
Offline  
Old 11-22-2008, 12:40 AM   #7
jacytan
Thumbs Must Hurt
 
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: Globe
Posts: 52
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, 05:31 PM   #8
bharath001
New Member
 
Join Date: Nov 2008
Model: 8800
PIN: N/A
Carrier: att
Posts: 4
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, 07:21 AM   #9
sickned
Knows Where the Search Button Is
 
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Posts: 42
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, 01:03 AM   #10
mithleshdwivedi
New Member
 
Join Date: Dec 2008
Model: 7100T
PIN: N/A
Carrier: nothing
Posts: 14
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, 01:22 AM   #11
baran_khan
Thumbs Must Hurt
 
baran_khan's Avatar
 
Join Date: Apr 2008
Model: 9500
PIN: N/A
Carrier: Airtel
Posts: 110
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, 01:38 AM   #12
mithleshdwivedi
New Member
 
Join Date: Dec 2008
Model: 7100T
PIN: N/A
Carrier: nothing
Posts: 14
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, 01:40 AM   #13
baran_khan
Thumbs Must Hurt
 
baran_khan's Avatar
 
Join Date: Apr 2008
Model: 9500
PIN: N/A
Carrier: Airtel
Posts: 110
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 01:54 AM..
Offline  
Old 12-05-2008, 02:05 AM   #14
mithleshdwivedi
New Member
 
Join Date: Dec 2008
Model: 7100T
PIN: N/A
Carrier: nothing
Posts: 14
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, 05:36 AM   #15
my_aro
New Member
 
Join Date: Oct 2008
Model: 9000
PIN: N/A
Carrier: Smart
Posts: 14
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, 02:51 AM   #16
manyguns
New Member
 
Join Date: Dec 2008
Model: 9500
PIN: N/A
Carrier: Verizon
Posts: 2
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, 04:17 AM   #17
baran_khan
Thumbs Must Hurt
 
baran_khan's Avatar
 
Join Date: Apr 2008
Model: 9500
PIN: N/A
Carrier: Airtel
Posts: 110
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, 09:40 AM   #18
manyguns
New Member
 
Join Date: Dec 2008
Model: 9500
PIN: N/A
Carrier: Verizon
Posts: 2
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, 03:31 AM   #19
Meenal
Thumbs Must Hurt
 
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Posts: 117
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 04:26 AM..
Offline  
Old 12-13-2008, 06:35 AM   #20
Meenal
Thumbs Must Hurt
 
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Posts: 117
Default

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

Last edited by Meenal; 12-13-2008 at 06: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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Agilent E8403A VXI Mainframe + E8491B, E4808A, 7x E8461B Modules with WARRANTY picture

Agilent E8403A VXI Mainframe + E8491B, E4808A, 7x E8461B Modules with WARRANTY

$3900.00



TEKTRONIX TM5006A 6 BAY MAINFRAME.  (chassis Mainframe only) picture

TEKTRONIX TM5006A 6 BAY MAINFRAME. (chassis Mainframe only)

$200.00



HP 3488A HPIB Switch / Control Unit Mainframe picture

HP 3488A HPIB Switch / Control Unit Mainframe

$24.99



Tektronix TM5003 Power Module Mainframe Chassis picture

Tektronix TM5003 Power Module Mainframe Chassis

$225.00



Agilent HP E8404A VXI Mainframe C-Size, 13 Slot 1000W w/E491B, E1472X2 UNTESTED picture

Agilent HP E8404A VXI Mainframe C-Size, 13 Slot 1000W w/E491B, E1472X2 UNTESTED

$499.99



Computer Conversions Corp. Main Frame Board RTSS-4 picture

Computer Conversions Corp. Main Frame Board RTSS-4

$375.00







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.