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.