10-13-2009 02:45 PM
I am trying to call a webservice from Blackberry JDE application. Following is the code and it is not working.
on ht.call function, it just sits there. not error though. I think action string is wrong. any ideas.
public void initiateWebService()
SoapObject client = new SoapObject(serviceUrl,method);
HttpTransport ht = new HttpTransport(serviceUrl);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = client;
envelope.dotNet = false; //I guess this has to be false since it is not dotnet
String response = envelope.getResponse().toString();
10-13-2009 04:05 PM
I would strongly recommend getting Sun's Java Wireless Toolkit 2.5.2_01 for CLDC from their site (Sun JWT) and using the Stub Generator in the Utilities application to create the web service stubs that you can them import to your project. I've used this for a .NET WCF service and a .NET Web Service and both worked great.
The one thing you will need to consider is the method parameters and return types - they should be as standard as possible (you can use classes but their internal member variable data types should also be types that are supported). For supported types see below.
One thing i have found is that the stub generator won't generate stubs when the return type is a class that contains a member variable that is an instance of the same class - also, DateTime objects aren't always handled well so you probably want to return a string representation of your datetime in a pre-determined format.
01-10-2011 08:18 AM
01-10-2011 10:32 AM
Hi Simon, I had already tried with ksoap. It works fine with .asmx service. But when I tried ksoap with WCF Service, it gives me the exception: org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_DOCUMENT null@1:0 in java.io.InputStreamReader@44ebb7e0)
Is there any specific setting for consuming WCF service using ksoap?
Thanks & Regards,
01-10-2011 10:43 AM
01-11-2011 03:36 AM
01-12-2011 12:50 AM
I have extended class "ServiceConnectionMidp" and override the "openInputStream" method. But when I use:
int nLength = (int)connection.getLength(); OR int nLength = oInputStream.available();
gives nLength = 0.
I have also tried: IOUtilities.streamToBytes(oInputStream); But is is not working.
Thanks & Regards,
01-12-2011 03:50 AM