BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 02-18-2009, 03:55 PM   #1
littleb1980
New Member
 
Join Date: Jan 2009
Model: 8330
PIN: N/A
Carrier: Bell
Posts: 3
Default KSOAP2 Issue

Please Login to Remove!

Hello,

I'm hoping someone can shed some light as to what I'm doing wrong. I currently have a Blackberry application that communicates with a web service I created. I am using HTTP POST as the communication method, and all works well.

However, I would like to try and pass complex object types, and have read in some post to try and use KSoap2, which I did.

I've referred to multiple discussions and have done the following. I preverified the KSOAP2 jar file, I added it as a dependency to my project. The code builds with no issues in the Blackberry JDE (4.2.0.98).

Everything seems fine, however I always receive the following exception in code which I cannot catch in a try statement:
"Uncaught Exception: Cannot find class ksoap.*", pretty much this message appears multiple times for various ksoap classes.

Code snippet:
Code:
public boolean ValidateLoginTokenKSOAP(LoginToken token){
        
        SoapObject rpc;
        SoapSerializationEnvelope env;
        HttpTransport ht;
        
        boolean blnValid = false;
        String urlRequest;
        String result;
        
        try
        {
          
            //serviceUrl = "xxxx://172.20.8.221/ACRWebService/ACRService.asmx";
            serviceNamespace = "xxxx://tempuri.org/";
            soapAction = "xxxx://tempuri.org/ValidateLoginCredentials";
            serviceMethod = "ValidateLoginToken";
            
            rpc = new SoapObject(serviceNamespace, serviceMethod);       
            rpc.addProperty("token", token);            
                 
            env = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            
            env.bodyOut = rpc;
            env.dotNet = true;
            env.encodingStyle = SoapSerializationEnvelope.ENC;
            
            ht = new HttpTransport(serviceUrl);
            ht.debug = true;
            ht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); 
                        
            result = null;
            
            blnValid = true;
            try
            {
                Object resp = null;
                System.out.println("Call for ht");
                ht.call(soapAction, env);
                resp = env.getResult();    
                System.out.println("Success!!");
            }
            catch(org.xmlpull.v1.XmlPullParserException ex2)
            {
                blnValid = false;
                String bah = ex2.toString();
                System.out.println(bah);
            }
            catch(Exception e)
            {
                blnValid = false;
                String bah = e.toString();
                System.out.println(bah);
            }
            
        }
        catch(Exception e)
        {            
            blnValid = false;
        }
        
        return blnValid;
    }
The exception always get's thrown on ht.call(soapAction, env);

Any help would be appreciated, I'm stumped on this. I know the reason is the library cannot be found on the simulator, but not sure how to fix it.

Last edited by littleb1980; 02-18-2009 at 03:59 PM.. Reason: Added Code Snippet
Offline  
Old 02-19-2009, 03:02 AM   #2
simon.hain
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Default

add the cod file of the ksoap library to the simulator directory
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 02-19-2009, 08:50 AM   #3
littleb1980
New Member
 
Join Date: Jan 2009
Model: 8330
PIN: N/A
Carrier: Bell
Posts: 3
Default

I copied the KSoap.cod file to both these directories...

1. C:\Program Files\Research In Motion\BlackBerry Device Simulators 4.2.2\4.2.2.163 (8310-Rogers)
2. C:\Program Files\Research In Motion\BlackBerry Device Simulators 4.2.2\4.2.2.163 (8310-Rogers)\Java

They both contain other .cod files for the simulator I'm using. However, still receiving the error message.

Should I try and convert ksoap2-j2me-core-prev-2.1.2.jar which contains the classes directly to a .cod file. Right now the .cod I copied over is simply the one generated from my JDE application, which contains the ksoap2 jar file. If so, any utilities to convert a jar to .cod file easily readily available?

Thanks
Offline  
Old 02-19-2009, 01:57 PM   #4
littleb1980
New Member
 
Join Date: Jan 2009
Model: 8330
PIN: N/A
Carrier: Bell
Posts: 3
Default

I found the solution, when you preverify the .jar file, the verified copy is put in
C:\Program Files\Research In Motion\BlackBerry JDE 4.2.0\bin\output. I was using the jar that a preverified and not realizing that a verified one is created.



Hope this helps anyone else who encounters this problem.
Offline  
Closed Thread



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


Motorola 68060 68EC060 MC68EC060RC75 CPU / Processor AMIGA unused, new USA stock picture

Motorola 68060 68EC060 MC68EC060RC75 CPU / Processor AMIGA unused, new USA stock

$69.99



New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga PC Case 1598 picture

New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga PC Case 1598

$36.66



New Amiga Gotek OLED IIC I2C 0.91

New Amiga Gotek OLED IIC I2C 0.91" 128x32 LCD Display Module 3.3V 5V White 679

$6.57



New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga Atari ST 1591 picture

New Greaseweazle V4.1 USB Floppy Adapter Flux Reader Writer Amiga Atari ST 1591

$28.73



*PARTS/REPAIR* Mitsubishi FR-A520-5.5K-NA A500vInverter In: 35.5A 3Ph Out: 10Hp picture

*PARTS/REPAIR* Mitsubishi FR-A520-5.5K-NA A500vInverter In: 35.5A 3Ph Out: 10Hp

$750.00



DB23 connectors for soldering. 23-pin D type for Amiga. Male / Female / Hoods picture

DB23 connectors for soldering. 23-pin D type for Amiga. Male / Female / Hoods

$12.42







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