BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 12-16-2008, 01:29 AM   #21 (permalink)
New Member
 
Join Date: Dec 2008
Model: 7800
PIN: N/A
Carrier: AT&T
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please Login to Remove!

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

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

Thank you
Alessio
Offline  
Old 12-23-2008, 01:54 PM   #23 (permalink)
New Member
 
Join Date: Nov 2008
Model: 8220
PIN: N/A
Carrier: T-Mobile
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Arrow Complex Types

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
Offline  
Old 12-30-2008, 02:43 AM   #24 (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 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
Offline  
Old 01-04-2009, 05:45 PM   #25 (permalink)
tbi
New Member
 
Join Date: Dec 2008
Model: 9000
PIN: N/A
Carrier: Rogers
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting up Ksoap2 & BB Eclipse Plugin

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!
Offline  
Old 03-03-2009, 05:14 PM   #26 (permalink)
Thumbs Must Hurt
 
Join Date: May 2008
Model: 8700
PIN: N/A
Carrier: Telcel
Posts: 69
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
Offline  
Old 03-17-2009, 03:30 PM   #27 (permalink)
New Member
 
Join Date: Mar 2009
Model: Pearl
PIN: N/A
Carrier: Verizon
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

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.
Offline  
Old 03-25-2009, 05:11 PM   #29 (permalink)
New Member
 
Join Date: Mar 2009
Model: Pearl
PIN: N/A
Carrier: Verizon
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

@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.
Offline  
Old 04-14-2009, 02:58 AM   #30 (permalink)
New Member
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: Cincinnati Bell
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default preVerify and attaching

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.
Offline  
Old 04-14-2009, 03:01 AM   #31 (permalink)
New Member
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: Cincinnati Bell
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Just thought of another question.

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

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.
Offline  
Old 04-24-2009, 04:46 AM   #33 (permalink)
New Member
 
Join Date: Apr 2009
Model: 7100T
PIN: N/A
Carrier: develloper
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs down

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
Offline  
Old 04-24-2009, 03:03 PM   #34 (permalink)
New Member
 
Join Date: Apr 2009
Model: 8300
PIN: N/A
Carrier: 8300
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


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

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.
Offline  
Old 05-23-2009, 07:59 AM   #36 (permalink)
New Member
 
Join Date: May 2009
Model: 8300
PIN: N/A
Carrier: sprint
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default tunnel time out

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.
Offline  
Old 05-23-2009, 08:36 AM   #37 (permalink)
New Member
 
Join Date: May 2009
Model: storm
PIN: N/A
Carrier: verizon
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default error starting: httpd module soap j2me-core-2.1.2 not found

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
Offline  
Old 05-27-2009, 05:32 AM   #38 (permalink)
New Member
 
Join Date: May 2009
Model: 7100T
PIN: N/A
Carrier: nothing
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Offline  
Old 06-12-2009, 11:07 AM   #39 (permalink)
Thumbs Must Hurt
 
Join Date: Feb 2009
Location: CANADA
Model: 9000
PIN: N/A
Carrier: Rogers
Posts: 64
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 simulatorxxx8217;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.
Offline  
Old 06-19-2009, 02:53 AM   #40 (permalink)
New Member
 
Join Date: Jun 2009
Model: 8300
PIN: N/A
Carrier: Airtel
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

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