BlackBerry JDE and kSoap and noobs -
07-18-2008, 03:27 PM
Hello,
I've noticed a lot of posts that deal with kSoap2 and JDE 4.x and people new to the platform. Being new to Java and Blackberry development, I struggled with it the past week and wanted to make a post so that others wont have to spend so much time hunting and searching like I did. I hope this helps.
I am assuming you have JDE 4.x installed.
see below for correct steps as of 2 pm 7/18/08.
Last edited by jeckerlin : 07-18-2008 at 04:03 PM.
Reason: i failed
Sponsored Links
Please Login or Register to Remove these Advertisements!
looks like I got a little ahead of myself. Looks like you need to do things a little differently so the blackberry device will load the ksoap files correctly.
Modified steps appear to be:
1) You need a preverified ksoap2-j2me-core-2.1.2.jar (attached) file. The ones from the kSoap site aren’t preverified and when attempting to do so it failed. I attempting to go through a preverification process but have been unsuccessful. I obtained the attached jar from a post by richard.puckett of a preverified ksoap2-j2me-core-2.1.2.jar file.
Since I'm new to the forums, I cant specify a direct link to the file. If you do a search for a thread called 'Preverified ksoap2' you can find Richard's link
to the file.
2) Within your JDE project, create a ‘lib’ folder. Using Windows Explorer, create a lib folder within your project and put the ksoap2-j2me-core-2.1.2.jar file in there.
3) Create a new 'Library' in your JDE workspace called kSoap. Add the preverified ksoap2-j2me-core-2.1.2.jar in the lib folder to that library.
4) Set the project dependencies to depend on the new library. Right click your main project -> select project dependencies -> select the kSoap library as a dependency
5) compile w/o errors
Below is simple code to call a .Net web service:
code extract from java file:
String serviceUrl = "<url to web service>l";
String serviceNamespace = "h t t p : / / tempuri . org /";
String soapAction = "h t t p : / / tempuri.org / HelloWorld";
SoapObject rpc = new SoapObject(serviceNamespace, "HelloWorld");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
Code Extract from .Net web Service
namespace TestService
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "h t t p : / / tempuri . org /")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
Here is another example passing in a simple string parameter:
java:
String serviceUrl = <url to web service>;
String serviceNamespace = "h t tp ://tempuri.org/";
String soapAction = h t tp://tempuri.org/HelloWorldParam";
String methodName = "HelloWorldParam";
SoapObject rpc = new SoapObject(serviceNamespace, methodName);
rpc.addProperty("Name", "Jeff");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
.net web service
namespace TestService
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "h t tp : //tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
java:
String serviceUrl = "h t t p://192.168.0.103/BBService/Service1.asmx";
String serviceNamespace = "h t t p//tempuri.org/";
String soapAction = "h t t p://tempuri.org/HelloWorldComplexType";
String methodName = "HelloWorldComplexType";
SoapObject rpc = new SoapObject(serviceNamespace, methodName);
rpc.addProperty("Name", "Jeff");
rpc.addProperty("Password", "nonya");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
.net web service:
namespace TestService
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "h t t p://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
Excellant jeckerlin, appreciate you taking the time to help out us newbies.
The only thing i'm having problems with is that i am using Eclipse and can't seem to get the ksoap libraries to compile along with the rest of the code into 1 cod file. You describe how to do this in JDE, any ideas how to in Eclipse?
I/O Error: Import file not found: ..\ksoap\ksoap.jar
Error while building project
That's the error I get when I follow the directions above. The project I created I made a Library project. There is no ksoap.jar. Don't know why there would be.