BlackBerryForums.com : Your Number One BlackBerry Community
     

»Sponsored Links


BlackBerryApps.com Best Sellers



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
sickned Offline
Knows Where the Search Button Is
 
Posts: 42
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Lightbulb **** BlackBerry and Ksoap2 Tutorial ***** - 10-22-2008, 10:31 AM

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, 1060 views)

Last edited by sickned : 11-19-2008 at 11:06 AM.
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
ArthurKnight Offline
New Member
 
Posts: 11
Join Date: Oct 2008
Model: 8100
PIN: N/A
Carrier: TELCEL
Default 10-22-2008, 07:13 PM

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
   
Reply With Quote
  (#3 (permalink)) Old
pmardones Offline
New Member
 
Posts: 4
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: telefonica
Default can't see the tag BB project dependencies - 10-27-2008, 10:07 AM

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 :(
   
Reply With Quote
  (#4 (permalink)) Old
bsecurity Offline
New Member
 
Posts: 5
Join Date: Feb 2008
Model: 8703e
PIN: N/A
Carrier: Rogers
Default 11-13-2008, 10:59 PM

great jobs!
   
Reply With Quote
  (#5 (permalink)) Old
jacytan Offline
Thumbs Must Hurt
 
Posts: 51
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: Globe
Default 11-19-2008, 04:33 AM

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
   
Reply With Quote
  (#6 (permalink)) Old
sickned Offline
Knows Where the Search Button Is
 
Posts: 42
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Default 11-19-2008, 11:01 AM

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.
   
Reply With Quote
  (#7 (permalink)) Old
jacytan Offline
Thumbs Must Hurt
 
Posts: 51
Join Date: Oct 2008
Model: 8800
PIN: N/A
Carrier: Globe
Default 11-22-2008, 12:40 AM

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!
   
Reply With Quote
  (#8 (permalink)) Old
bharath001 Offline
New Member
 
Posts: 4
Join Date: Nov 2008
Model: 8800
PIN: N/A
Carrier: att
Default Still no luck - 11-25-2008, 05:31 PM

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.
   
Reply With Quote
  (#9 (permalink)) Old
sickned Offline
Knows Where the Search Button Is
 
Posts: 42
Join Date: Oct 2008
Model: 7100T
PIN: N/A
Carrier: Unknow
Default 12-01-2008, 07:21 AM

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.
   
Reply With Quote
  (#10 (permalink)) Old
mithleshdwivedi Offline
New Member
 
Posts: 14
Join Date: Dec 2008
Model: 7100T
PIN: N/A
Carrier: nothing
Default hey sorry to say m new in this using Ksoap bt i have to do a project in this . - 12-05-2008, 01:03 AM

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
   
Reply With Quote
  (#11 (permalink)) Old
baran_khan Offline
Thumbs Must Hurt
 
baran_khan's Avatar
 
Posts: 107
Join Date: Apr 2008
Model: 8800
PIN: N/A
Carrier: Airtel
Default 12-05-2008, 01:22 AM

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!!!
   
Reply With Quote
  (#12 (permalink)) Old
mithleshdwivedi Offline
New Member
 
Posts: 14
Join Date: Dec 2008
Model: 7100T
PIN: N/A
Carrier: nothing
Default hi - 12-05-2008, 01:38 AM

ksoap2-j2me-core-prev-2.1.2

sir m using ksoap2 preverified jar....kindly help
and thanks for ur post
   
Reply With Quote
  (#13 (permalink)) Old
baran_khan Offline
Thumbs Must Hurt
 
baran_khan's Avatar
 
Posts: 107
Join Date: Apr 2008
Model: 8800
PIN: N/A
Carrier: Airtel
Default 12-05-2008, 01:40 AM

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.
   
Reply With Quote
  (#14 (permalink)) Old
mithleshdwivedi Offline
New Member
 
Posts: 14
Join Date: Dec 2008
Model: 7100T
PIN: N/A
Carrier: nothing
Default hi - 12-05-2008, 02:05 AM

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

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..
   
Reply With Quote
  (#16 (permalink)) Old
manyguns Offline
New Member
 
Posts: 2
Join Date: Dec 2008
Model: 9500
PIN: N/A
Carrier: Verizon
Default 12-11-2008, 02:51 AM

I am running into the same problem with not seeing "Blackberry project dependencies" under the project options. Anybody have any ideas?
   
Reply With Quote
  (#17 (permalink)) Old
baran_khan Offline
Thumbs Must Hurt
 
baran_khan's Avatar
 
Posts: 107
Join Date: Apr 2008
Model: 8800
PIN: N/A
Carrier: Airtel
Default 12-11-2008, 04:17 AM

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!!!
   
Reply With Quote
  (#18 (permalink)) Old
manyguns Offline
New Member
 
Posts: 2
Join Date: Dec 2008
Model: 9500
PIN: N/A
Carrier: Verizon
Default 12-11-2008, 09:40 AM

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...
   
Reply With Quote
  (#19 (permalink)) Old
Meenal Offline
Thumbs Must Hurt
 
Posts: 113
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Default testing webservice on simulator - 12-13-2008, 03:31 AM

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.
   
Reply With Quote
  (#20 (permalink)) Old
Meenal Offline
Thumbs Must Hurt
 
Posts: 113
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Default 12-13-2008, 06:35 AM

Hi all,
I have solved the above problem.


Thanks
Meenal

Last edited by Meenal : 12-13-2008 at 06:44 AM.
   
Reply With Quote
  (#21 (permalink)) Old
peter_bb Offline
New Member
 
Posts: 1
Join Date: Dec 2008
Model: 7800
PIN: N/A
Carrier: AT&T
Default 12-16-2008, 01:29 AM

Quote:
Originally Posted by Meenal View Post
Hi all,
I have solved the above problem.
Meenal, could you describe how you solved the problem?
   
Reply With Quote
  (#22 (permalink)) Old
a.menini Offline
New Member
 
Posts: 1
Join Date: Dec 2008
Model: 8800
PIN: N/A
Carrier: UMTS
Default Help - 12-23-2008, 04:42 AM

I have the same exception (XmlPullParserException), how have you resolve the problem?

Thank you
Alessio
   
Reply With Quote
  (#23 (permalink)) Old
New Member
 
Posts: 1
Join Date: Nov 2008
Model: 8220
PIN: N/A
Carrier: T-Mobile
Arrow Complex Types - 12-23-2008, 01:54 PM

Has anyone here been using ksoap2 with complex web services? I have gotten basic web service calls working with no problem. But in the project I am working on we have nested classes and data in almost all of the webservice calls and I am trying to use the ksoap2 ClassMap functionality to get my java objects populated. Even using it on a simple webservice call I can not seem to get the mapping correct. I end up getting ClassCastExceptions thrown. I have been able to view the data using the debug functionality in ksoap2 and the data I am getting should match up just fine with what object I am trying to cast the data to, but it doesn't work for some reason. If anyone has hints or worked on more complex webservice calls with ksoap let me know I could use all the help I can get right now on this. Examples would be good too. I have yet to find examples for ksoap that use complex types and nest class data structures.

Thanks!

- Dorian
   
Reply With Quote
  (#24 (permalink)) Old
Meenal Offline
Thumbs Must Hurt
 
Posts: 113
Join Date: Jan 2007
Location: India
Model: 8700g
Carrier: Airtel
Default 12-30-2008, 02:43 AM

Hi peter_bb,

sorry for the late reply, u might jave already solved the problem, but still ....

u need to specify the soapaction in the following statement:

ht.call(soapAction, envelope);
i my previous code i had kept null >> "".


Thanks
Meenal
   
Reply With Quote
  (#25 (permalink)) Old
tbi Offline
New Member
 
Posts: 4
Join Date: Dec 2008
Model: 9000
PIN: N/A
Carrier: Rogers
Default Setting up Ksoap2 & BB Eclipse Plugin - 01-04-2009, 05:45 PM

Thanks for posting this tutorial! I'm trying to setup ksoap2 with Blackberry JDE plugin but I have problems with couple of the steps you mentioned:


Quote:
Originally Posted by sickned View Post
- Right click on the project->Add file to Blackberry Project-> Select the ksoap2 jar from the "lib" folder.
When I right click on the project, I can't find the option "Add file to Blackberry Project" - can someone please confirm if this is a mistake or am I missing something?


Quote:
Originally Posted by sickned View Post
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".
When exactly does ksoap2.jar get created? I've added the pre-verified ksoap2 library (attached in the original post) to my project but I can't find "ksoap2.jar".

Any help/suggestions are welcome

Thanks!
   
Reply With Quote
  (#26 (permalink)) Old
CJLopez Offline
Thumbs Must Hurt
 
Posts: 68
Join Date: May 2008
Model: 8700
PIN: N/A
Carrier: Telcel
Default 03-03-2009, 05:14 PM

WOOOOOOOOOOO, thanks for the preverified library.

I have been struggling to get this preverified and wasted a whole day on that.

Been working on J2ME directly and boss wanted me to use BB JDE as the end device to use its the BB

Quote:
Originally Posted by tbi View Post
Thanks for posting this tutorial! I'm trying to setup ksoap2 with Blackberry JDE plugin but I have problems with couple of the steps you mentioned:
When I right click on the project, I can't find the option "Add file to Blackberry Project" - can someone please confirm if this is a mistake or am I missing something?
Its "Add File to Project"

Quote:
Originally Posted by tbi View Post
When exactly does ksoap2.jar get created? I've added the pre-verified ksoap2 library (attached in the original post) to my project but I can't find "ksoap2.jar".

Any help/suggestions are welcome

Thanks!
When adding the file, on File Type just select "All the files" so the jar file appears and then add it to the new project

Last edited by CJLopez : 03-03-2009 at 05:19 PM.
   
Reply With Quote
  (#27 (permalink)) Old
mello151 Offline
New Member
 
Posts: 2
Join Date: Mar 2009
Model: Pearl
PIN: N/A
Carrier: Verizon
Default 03-17-2009, 03:30 PM

Did anyone solve the XmlPullParser Exception?
   
Reply With Quote
  (#28 (permalink)) Old
meetbishop Offline
New Member
 
Posts: 2
Join Date: Mar 2009
Model: 8830
PIN: N/A
Carrier: Vorizon Wireless
Default 03-25-2009, 05:01 PM

Quote:
Originally Posted by sickned View Post
Are you using Eclipse or JDE? This tutorial is for Eclipse, I dont know how to do some steps at JDE.
I am Using Eclipse Ver 3.4.0 and BlackBerry JDE Plug-in For Eclipse Ver. 1.0.0.50 and i also don't See "Add file to Blackberry Project". and the Ksoap2.jar file is not created. I see jar files for all my other project but not for the Ksoap2 library project.
   
Reply With Quote
  (#29 (permalink)) Old
mello151 Offline
New Member
 
Posts: 2
Join Date: Mar 2009
Model: Pearl
PIN: N/A
Carrier: Verizon
Default 03-25-2009, 05:11 PM

@meetbishop

I'm set up the same way as you. I gave up and decided to use the web service libraries in the J2ME. Only problem is that the blackberry has to be running 4.3.
   
Reply With Quote
  (#30 (permalink)) Old
Drakhelm Offline
New Member
 
Posts: 3
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: Cincinnati Bell
Default preVerify and attaching - 04-14-2009, 02:58 AM

Okay, well, I have a few questions of my own, but I figured I might post what I've learned.

First, you need to preverify the ksoap-core.jar (you can't preverify the ksoap-full.jar, it gives you an error.)

To do that, after you download the ksoap-core.jar you're going to use the command line (cmd.com/cmd.exe) to navigate to wherever you installed the JDE
then run

preverify -classpath <path to net_rim_api.jar> <path to ksoap2-j2me-core-*.jar>

this will give you an output folder in your bin directory (or probably whatever directory you run the preverify utility from (I'm not sure, I've just ran it from the bin directory of the JDE)

In the output folder will be a ksoap-whatever.jar file that is slightly bigger than the original .jar file.

You're going to (this is important) want to create a "lib" folder under the project folder that you want to attach the ksoap2 to.

Once you have that, what you want to do is create a new project

Once you have done that change the project type (project->properties->application tab) from the CDLC App to Library, and import the ksoap2.jar that was created when you ran the preverify (the one that you hopefully moved to the "lib" path under your project path.

Now, build that project, and you should get a ksoap2.cod file as output, which is fine, leave it alone.

Now, in your project (this should all have occurred in the same workspace) go to project->dependencies-> and specify that it is dependent on the ksoap2 project.

That should allow you to import the ksoap library.

(Though I do wonder if there's anyway to get the IDE to recognize the ksoap2 classes so it'll automatically give you the function definitions and class definitions)


Now, that handles the attaching of the files.

My questions are

1. Where do I get a MDS Simulator? (I checked the rim site, but I can't find an MDS Simulator anywhere.)

2. Can some one help me with this, on the device the following is throwing a
java.io.ioexception: Tunnel timed out

Code:
/*
 * ksoaptest.java
 *
 * © <your company here>, 2003-2008
 * Confidential and proprietary.
 */

package ;

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 net.rim.blackberry.api.invoke.*;
import java.util.*;
import java.lang.*;
import javax.microedition.pim.*;
import net.rim.device.api.i18n.*;
import net.rim.device.api.system.*;
import net.rim.device.api.util.*;
import org.ksoap2.*;
import org.ksoap2.serialization.*;
import org.ksoap2.transport.*;
import java.io.*;
import javax.microedition.io.*;
import net.rim.device.api.crypto.certificate.x509.*;


/**
 * 
 */
class ksoaptest extends net.rim.device.api.ui.UiApplication {
    ksoaptest() {            
        pushScreen(new kScreen());
    }
    
    public static void main(String args[]) {
        ksoaptest kst = new ksoaptest();
        kst.enterEventDispatcher();
    }
} 

class kScreen extends MainScreen {
    public LabelField lf_title;
    public RichTextField rf_results;
    public String results;
            
    public MenuItem mi_runtest = new MenuItem("Run SOAP Test",4390,10) {
        public void run() {
            RunTest();
        }
    };
    
    protected void makeMenu(Menu menu,int instance) {
        menu.add(mi_runtest);
        super.makeMenu(menu,0);
    }
    
    public kScreen() {
        lf_title = new LabelField("KSoap Test");        
        add(lf_title);
        
        rf_results = new RichTextField("Results");
        add(rf_results);
        
        results = "";        
        
    }        
    
    public void RunTest() {
        try {            
            System.out.println("Initializing Strings");
            String serviceNamespace = "h**p://w w w . exa mple. c o m/import/";
            String serviceURL = "h**p://w w w . exa mple. c o m/import/blackberry.wsdl";
            String serviceAction = "h**p://w w w . exa mple. c o m/import/blackberry.php";
            String serviceMethod = "HelloWorld";
            System.out.println("Strings Initialized, Instantiating Variables");
        
            SoapObject request = new SoapObject(serviceNamespace,serviceMethod);
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.bodyOut = request;
            HttpTransport ht = new HttpTransport(serviceURL);
            System.out.println("Variables Instantiated, making HTTP Call");
            ht.call(serviceAction,envelope);            
            System.out.println("About to display results.");
            results = (String)envelope.getResponse();
        }
        catch(Exception exception) {
            System.out.println("EXCEPTION EXCEPTION EXCEPTION (Exception Thrown)");
            results = exception.toString();
        }
        rf_results.setText(results);
    }
    
}
Thank you for your time.
   
Reply With Quote
  (#31 (permalink)) Old
Drakhelm Offline
New Member
 
Posts: 3
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: Cincinnati Bell
Default 04-14-2009, 03:01 AM

Just thought of another question.

How would you get it to ignore ssl x509 certificate errors?
   
Reply With Quote
  (#32 (permalink)) Old
Drakhelm Offline
New Member
 
Posts: 3
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: Cincinnati Bell
Default 04-14-2009, 03:54 PM

Okay, well I got KSOAP working on the device simulator, but when I go and attempt to use it on the test device I'm getting a tunnel time out error.

Changed the code from above, and it worked on the MDS Simulator and device simulator, but not on the actual device.

Any suggestions?

Pointers?

Thanks.
   
Reply With Quote
  (#33 (permalink)) Old
pololalo Offline
New Member
 
Posts: 9
Join Date: Apr 2009
Model: 7100T
PIN: N/A
Carrier: develloper
Thumbs down 04-24-2009, 04:46 AM

i have a problem is when I run the program I have an exception that says "error starting: httpd module soap j2me-core-2.1.2 not found"
knowing that I have imported the ksoap.jar in my eclipse
   
Reply With Quote
  (#34 (permalink)) Old
pintusza Offline
New Member
 
Posts: 2
Join Date: Apr 2009
Model: 8300
PIN: N/A
Carrier: 8300
Default 04-24-2009, 03:03 PM

Hi, I´m not able to get HttpTransportBasicAuth.class ... anywhere, is there any of you who could give me a link to get it.


Thanks a lot.
   
Reply With Quote
  (#35 (permalink)) Old
aregon Offline
New Member
 
Posts: 3
Join Date: Feb 2009
Model: 8330
PIN: N/A
Carrier: Airtel
Default 04-28-2009, 09:03 AM

Hi , I am facing 2 problems over here :

1) I tried to run this tutorial but the icon is not being displayed on the simulator & according to me it needs a .cod file which is not being generated.
2) The line, " Right click on the project->Add file to Blackberry Project-> Select the ksoap2 jar from the "lib" folder. " , is too much confusing as there is no such option displayed in eclipse. So anyone could plese upload a screen shot as to what this line refers to.
   
Reply With Quote
  (#36 (permalink)) Old
rboatright Offline
New Member
 
Posts: 1
Join Date: May 2009
Model: 8300
PIN: N/A
Carrier: sprint
Default tunnel time out - 05-23-2009, 07:59 AM

if it runs with the mds on the simulator and not on the actual device that's because using http services on the actual device requires that the app be SIGNED. You have to apply to RiM for a signing authority.

When you compile the app, it most certainly warns you about that at the top of the BUILD responses.

You'll have to apply to RiM and pay for a signing authority.
   
Reply With Quote
  (#37 (permalink)) Old
lpt1138 Offline
New Member
 
Posts: 1
Join Date: May 2009
Model: storm
PIN: N/A
Carrier: verizon
Default error starting: httpd module soap j2me-core-2.1.2 not found - 05-23-2009, 08:36 AM

The dependency step solved my error starting problem . That step caused the ksoap2 module to be loaded in the simulator along with my project.

"Now, in your project (this should all have occurred in the same workspace) go to project->dependencies-> and specify that it is dependent on the ksoap2 project."

Quote:
Originally Posted by pololalo View Post
i have a problem is when I run the program I have an exception that says "error starting: httpd module soap j2me-core-2.1.2 not found"
knowing that I have imported the ksoap.jar in my eclipse
   
Reply With Quote
  (#38 (permalink)) Old
New Member
 
Posts: 2
Join Date: May 2009
Model: 7100T
PIN: N/A
Carrier: nothing
Default 05-27-2009, 05:32 AM

Quote:
Originally Posted by Meenal View Post
Hi peter_bb,

sorry for the late reply, u might jave already solved the problem, but still ....

u need to specify the soapaction in the following statement:

ht.call(soapAction, envelope);
i my previous code i had kept null >> "".
Hi Meenal,

can you please tell me what is this soapaction in this case. I am novice in BlackBerry webservice development.

Thanks,
Rajnikant
   
Reply With Quote
  (#39 (permalink)) Old
koic Offline
Thumbs Must Hurt
 
Posts: 62
Join Date: Feb 2009
Location: CANADA
Model: 9000
PIN: N/A
Carrier: Rogers
Default 06-12-2009, 11:07 AM

Hi all.

First of all, BIG thanks to sickned At least for the attempt to show us
how it should look like (please, no offence intended).
But as you might already notice
the attached code does not compile out of box, - problems on the lines 26 and 43.
First should be replaced with:
PHP Code:
Ksoap2Demo theApp = new Ksoap2Demo(); 
second:
PHP Code:
public Ksoap2DemoScreen (){ 
Only after that I could see something on the simulator’s screen
(Project type set to CLDC Application).
Next, it would be good if this example had some valid data/parameters and
actually retrieved some stocks from some sites.
Or at least gave (me) a 'hint' what to do
...
P.S. I'm on JDE 4.7.

Last edited by koic : 06-12-2009 at 11:14 AM.
   
Reply With Quote
  (#40 (permalink)) Old
Rashmi Offline
New Member
 
Posts: 1
Join Date: Jun 2009
Model: 8300
PIN: N/A
Carrier: Airtel
Default 06-19-2009, 02:53 AM

I am using the preverified ksoap jar provided by sickned , but i am unable to find the option Blackberry Dependencies in eclipse.
   
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.