BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 10-04-2010, 06:13 AM   #61 (permalink)
New Member
 
Join Date: Oct 2010
Model: 7100t
PIN: N/A
Carrier: system developer
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Ksoap2

Please Login to Remove!

Hey,

I'm working with an android project right now, but my problem that I cant import any of the ksoap2 packages and I don't know why I think their is some jar files missing in my application but still I can't recognize the problem. Please if anybody had any idea, I would appreciate that,

Nada
Offline  
Old 10-27-2010, 02:35 AM   #62 (permalink)
New Member
 
Join Date: Oct 2010
Model: 7100T
PIN: N/A
Carrier: test
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default org.xmlpull.v1.XmlPullParserException:excepted:STA RT_TAG

Hi All,

I am getting exception "org.xmlpull.v1.XmlPullParserException:excepted:ST ART_TAG Envelope {position:START _TAG < wsdl:definitions targetNameSpace ='urn:sap-com:document:sap:soap:functions:mc-style'>@1:630 in java.io.InputstreamReader". Can anybody please help me how to resolve this above error. I am getting error at http.call() method. i am getting soapAction as "". Because i am getting soapAction as "" from my wsdl file. Please help me how to come across this exception. I am using Eclipse Blackberry JDE plug-in and SAP.

Thanks in Advance,
Regards,
Prasad

Last edited by grp1260 : 10-27-2010 at 02:36 AM.
Offline  
Old 11-11-2010, 09:19 AM   #63 (permalink)
New Member
 
Join Date: Nov 2010
Model: 7100T
PIN: N/A
Carrier: developer
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I had some problem. Open in browseer source code your webservice, check NAMESPACE : "targetNamespace", check SOAP_ACTION: NAMESPACE + "operation name", check URL: "soapbind:address location". I'm used
URL="//x.x.x.x/1C/ws/ClientWS.1cws?wsdl" and got error, but when change URL="//x.x.x.x/1C/ws/ClientWS.1cws" problem was solved.
Offline  
Old 11-12-2010, 03:19 PM   #64 (permalink)
New Member
 
Join Date: Nov 2010
Model: 9700
PIN: N/A
Carrier: t-mobile
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

I'm hoping someone can help me out with this. I'm a .net developer, so I'm a little out of my element. I've followed the tutorial out there for eclipse on using the ksoap2-j2me-core-prev-2.1.2.jar. I've followed the steps using the preverified jar, and when I try to package my project it fails in the build stating Error: preverifier failed: C:\eclipse\plugins\net.rim.ejde.componentpack5.0.0 _5.0.0.25\components\bin\preverify.exe -d C:\Users\ ...
any thoughts?
Offline  
Old 11-12-2010, 03:29 PM   #65 (permalink)
New Member
 
Join Date: Nov 2010
Model: 9700
PIN: N/A
Carrier: t-mobile
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

Thought I had a solution, I was mistaken.

Last edited by pchristensen : 11-12-2010 at 03:41 PM.
Offline  
Old 11-14-2010, 01:27 PM   #66 (permalink)
New Member
 
Join Date: Nov 2010
Model: 7100T
PIN: N/A
Carrier: AT&T
Posts: 7
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

Hello,

I am running the below code, it runs without any error and warning but nothing display on simulator. i try to run wireshark i never found any request to my web service. Please correct me where is the wrong in below code.

Code:
package prueba;

import java.util.Vector;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.component.ListFieldCallback;
import net.rim.device.api.ui.container.MainScreen;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransport;

public class Ksoap2Demo extends UiApplication {
	
	
	public static void main(String[] args) {
		StockQuoteDemo theApp = new StockQuoteDemo();
		theApp.enterEventDispatcher();		
	}

	public Ksoap2Demo() {
		pushScreen(new Ksoap2DemoScreen());		
	}

	final class Ksoap2DemoScreen extends MainScreen {
		BasicEditField symbolField;		
		ButtonField bf;
		LabelField id;
		LabelField ref;
		LabelField nombre;		
		ListField myList;
		ListCallback oList;

		public StockQuoteScreen (){
			
			symbolField = new BasicEditField ("Introduzca id: ","",5, BasicEditField.FILTER_INTEGER);
			id = new LabelField("");
			ref = new LabelField("");
			nombre = new LabelField("");
			bf = new ButtonField ("Get price", Field.FOCUSABLE);
			bf.setChangeListener(new ClickBoton());
			myList = new ListField();
			oList = new ListCallback();

			
			setTitle (symbolField);			
			add (bf);
			add(id);
			add(ref);
			add(nombre);
			
			
		}
		public class ClickBoton implements FieldChangeListener{
			public void fieldChanged(Field field, int context) {
				obtenerArticuloSOAP(symbolField.getText());
				obtenerListaArticuloSOAP("0");
			}
		}

		public boolean onClose() {
			Dialog.alert("ADIOOO!!");
			System.exit(0);
			
			return true;
			
		}
		public void obtenerArticuloSOAP(String id) {
			try {
								
				
				SoapObject request = new SoapObject("urn:DEMO", "DEMOMETHOD");			
				request.addProperty("PARAMETER_ID", id);
				
				SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
				envelope.bodyOut = request;			
				HttpTransport ht = new HttpTransport("WEBSERVICE_URL");			
			
				//envelope.encodingStyle = SoapSerializationEnvelope.ENC;		
				
				ht.call("", envelope);	
				
				SoapObject result = (SoapObject)envelope.getResponse();
				this.id.setText(result.getProperty("id").toString());
				this.ref.setText(result.getProperty("referencia").toString());
				this.nombre.setText(result.getProperty("nombre").toString());			

			}

			catch (Exception e) {
				System.out.println("i am here in catch");
				e.printStackTrace();

			}
		}
		public void obtenerListaArticuloSOAP(String id) {
			try {
								
				
				SoapObject request = new SoapObject("urn:DEMO", "DEMOMETHOD");			
				request.addProperty("test", id);
				
				SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
				envelope.bodyOut = request;			
				HttpTransport ht = new HttpTransport("localhost:1119 / Service1.asmx / MS_CurrentBalace");			
			
				//envelope.encodingStyle = SoapSerializationEnvelope.ENC;		
				
				ht.call("", envelope);	
				
				SoapObject result = (SoapObject)envelope.getResponse();				
				Vector vector = new Vector();
				for(int i=0; i < result.getPropertyCount(); i++){
					SoapObject choice = (SoapObject)result.getProperty(i);
					if(choice!=null && choice.getProperty("nombre")!=null)
						vector.addElement(new String(choice.getProperty("nombre").toString()));
								
				}
								
				oList.setVector(vector);
				for(int i=0;i<vector.size();i++){
					myList.insert(i);
				}
				myList.setCallback(oList);
				add(myList);
			}

			catch (Exception e) {
				System.out.println("i am here in catch");
				e.printStackTrace();

			}
		}
		
		
		private class ListCallback implements ListFieldCallback {
			// the listElements vector contain the entries in the list
			private Vector listElements = new Vector();

			public void drawListRow(ListField arg0, Graphics g, int index,
					int y, int w) {
				if(listElements.size()>index){
					String text = (String)listElements.elementAt(index);				
					g.drawText(text, 0, y, 0, w);					
				}
			}

			public Object get(ListField list, int index) {
				if(listElements.size()>index){
					return listElements.elementAt(index);
				}
				return null;
			}

			public int getPreferredWidth(ListField arg0) {
				// TODO Auto-generated method stub
				return Graphics.getScreenWidth();
			}

			public int indexOfList(ListField arg0, String arg1, int arg2) {
				// TODO Auto-generated method stub
				return 0;
			}
			
			public void setVector(Vector v){
				this.listElements = v;
			}
			public void insert(String toInsert, int index) {
				listElements.addElement(toInsert);
			}
			
		}
	}


}
Offline  
Old 11-16-2010, 01:53 AM   #67 (permalink)
New Member
 
Join Date: Nov 2010
Model: 9630
PIN: N/A
Carrier: IUSACELL
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

Quote:
Originally Posted by Meenal View Post
Hi all,
I have solved the above problem.
Hello,


How did you solve the problem above?? could you help me
Offline  
Old 12-30-2010, 01:57 PM   #68 (permalink)
New Member
 
Join Date: Dec 2010
Model: 8300
PIN: N/A
Carrier: Entel
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Help

Quote:
Originally Posted by a.menini View Post
I have the same exception (XmlPullParserException), how have you resolve the problem?

Thank you
Alessio

Tuve el mismo problema y cambiť localhost por mi ip local;

I change localhost for my IP

Last edited by avidalg : 12-30-2010 at 02:30 PM.
Offline  
Old 03-28-2011, 08:13 PM   #69 (permalink)
New Member
 
Join Date: Mar 2011
Model: 8950
PIN: N/A
Carrier: US Cellular
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

Hi,
I have been stuck on the same line for the last 2 weeks! I am just about going insane. Here is my code:

Code:
try
		{
			SoapObject request = new SoapObject(namespace, method_name);
			request.addProperty("Celsius", "32");
			
			SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
			envelope.dotNet = true;
			envelope.encodingStyle = SoapSerializationEnvelope.XSD;
			envelope.bodyOut = request;
			
			HttpTransport transport = new HttpTransport(url);
			transport.debug = true;
			try
			{
				transport.call(soap_action, envelope);
				SoapPrimitive primitive = (SoapPrimitive)envelope.getResponse();

				((MyScreen)this.getActiveScreen()).add(new RichTextField("" + primitive));
			}
			catch(Exception ex)
			{
				((MyScreen)this.getActiveScreen()).add(new RichTextField("" + ex.getMessage()));
			}
		}
		catch (Exception e)
		{
			((MyScreen)this.getActiveScreen()).add(new RichTextField("failed2"));
		}
When I go through debug mode, it stops at the line "transport.call(soap_action, envelope);" And it pops up to a screen with no source code. "DatagramProtocol(ConnectionBase).receive(Datagram ) line: 538". Since I can't see the source code, I have absolutely no idea what is going wrong.

I'm using the webservice from w3schools. My variable values are in an image attached

Please help!!!


Please help!!!
Attached Images
File Type: jpg variables.jpg (32.7 KB, 24 views)
Offline  
Old 05-03-2011, 02:01 PM   #70 (permalink)
New Member
 
Join Date: Apr 2011
Model: 7100t
PIN: N/A
Carrier: Telefonica
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

i have the same problem as tapina.
Offline  
Old 05-18-2011, 06:02 PM   #71 (permalink)
New Member
 
Join Date: May 2011
Model: 7100T
PIN: N/A
Carrier: Rogers
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

Me too, I am having the same problem as tapina. Please help!!!

Last edited by mumuspace : 05-18-2011 at 06:04 PM.
Offline  
Old 05-31-2011, 03:58 AM   #72 (permalink)
New Member
 
Join Date: May 2011
Model: 7100
PIN: N/A
Carrier: Google
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

Quote:
Originally Posted by sickned View Post
I was very, very sick trying to make work the ksoap2's libraries at a BlackBerry app and now I get it, Im gonna make a tutorial for all the people at the forum that have the same problem I had.

Ive used Eclipse and the Blackberry JDE plugin.

First of all, download the ksoap2 library preverified. I've uploaded it in this post.

Then, follow the steps:

- Create a Blackberry library project in your workspace, Ksoap2. (Create a new project->Right click->Project Properties-> Blackberry Project Properties-> Application->Project type->Library
- Create a folder called "lib" at this new library project.
- Copy the ksoap2 preverified at this post to the lib folder. Right click at Eclipse and select "Add to build path".
- Right click on the project->Add file to Blackberry Project-> Select the ksoap2 jar from the "lib" folder.

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".

WARNING!!
Sometimes when you add a new library or change something in the build path, you must repeat the last step, because this checkbox get unchecked.

Now, you're ready to write your code.

I've uploaded a simple code sample calling a web service.

I hope this could be useful.

Change: I've re-uploaded the file, because it looks like be corrupted.
Hello sir,
Actually i am new to all this please help me.
I followed some steps but I am not getting.
Offline  
Old 06-08-2011, 03:51 AM   #73 (permalink)
New Member
 
Join Date: Jun 2011
Model: 9900
PIN: N/A
Carrier: IT (development)
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

Quote:
Originally Posted by sickned View Post
I was very, very sick trying to make work the ksoap2's libraries at a BlackBerry app and now I get it, Im gonna make a tutorial for all the people at the forum that have the same problem I had.

Ive used Eclipse and the Blackberry JDE plugin.

First of all, download the ksoap2 library preverified. I've uploaded it in this post.

Then, follow the steps:

- Create a Blackberry library project in your workspace, Ksoap2. (Create a new project->Right click->Project Properties-> Blackberry Project Properties-> Application->Project type->Library
- Create a folder called "lib" at this new library project.
- Copy the ksoap2 preverified at this post to the lib folder. Right click at Eclipse and select "Add to build path".
- Right click on the project->Add file to Blackberry Project-> Select the ksoap2 jar from the "lib" folder.

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".

WARNING!!
Sometimes when you add a new library or change something in the build path, you must repeat the last step, because this checkbox get unchecked.

Now, you're ready to write your code.

I've uploaded a simple code sample calling a web service.

I hope this could be useful.

Change: I've re-uploaded the file, because it looks like be corrupted.
Thanks a Lot ........
Offline  
Old 07-18-2011, 04:12 AM   #74 (permalink)
New Member
 
Join Date: Jul 2011
Model: 9530
PIN: N/A
Carrier: AT&T
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

i am unable to see on my simulator can any one help on below code i am struggling for past two weeks...8

package prueba;

import java.util.Vector;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.component.ListFieldCallback;
import net.rim.device.api.ui.container.MainScreen;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope ;
import org.ksoap2.transport.HttpTransport;

public class Ksoap2Demo extends UiApplication {


public static void main(String[] args) {
Ksoap2Demo theApp = new Ksoap2Demo();
theApp.enterEventDispatcher();
}

public Ksoap2Demo() {
pushScreen(new Ksoap2DemoScreen());
}

final class Ksoap2DemoScreen extends MainScreen {
BasicEditField symbolField;
ButtonField bf;
LabelField id;
LabelField ref;
LabelField nombre;
ListField myList;
ListCallback oList;

public Ksoap2DemoScreen (){

symbolField = new BasicEditField ("Introduzca id: ","",5, BasicEditField.FILTER_INTEGER);
id = new LabelField("");
ref = new LabelField("");
nombre = new LabelField("");
bf = new ButtonField ("Get price", Field.FOCUSABLE);
bf.setChangeListener(new ClickBoton());
myList = new ListField();
oList = new ListCallback();


setTitle (symbolField);
add (bf);
add(id);
add(ref);
add(nombre);


}
public class ClickBoton implements FieldChangeListener{
public void fieldChanged(Field field, int context) {
obtenerArticuloSOAP(symbolField.getText());
obtenerListaArticuloSOAP("0");
}
}

public boolean onClose() {
Dialog.alert("ADIOOO!!");
System.exit(0);

return true;

}
public void obtenerArticuloSOAP(String id) {
try {


SoapObject request = new SoapObject("urn:DEMO", "DEMOMETHOD");
request.addProperty("PARAMETER_ID", id);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
HttpTransport ht = new HttpTransport("WEBSERVICE_URL");

//envelope.encodingStyle = SoapSerializationEnvelope.ENC;

ht.call("", envelope);

SoapObject result = (SoapObject)envelope.getResponse();
this.id.setText(result.getProperty("id").toString( ));
this.ref.setText(result.getProperty("referencia"). toString());
this.nombre.setText(result.getProperty("nombre").t oString());

}

catch (Exception e) {
System.out.println("i am here in catch");
e.printStackTrace();

}
}
public void obtenerListaArticuloSOAP(String id) {
try {


SoapObject request = new SoapObject("urn:DEMO", "DEMOMETHOD");
request.addProperty("test", id);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
HttpTransport ht = new HttpTransport("localhost:1119 / Service1.asmx / MS_CurrentBalace");

//envelope.encodingStyle = SoapSerializationEnvelope.ENC;

ht.call("", envelope);

SoapObject result = (SoapObject)envelope.getResponse();
Vector vector = new Vector();
for(int i=0; i < result.getPropertyCount(); i++){
SoapObject choice = (SoapObject)result.getProperty(i);
if(choice!=null && choice.getProperty("nombre")!=null)
vector.addElement(new String(choice.getProperty("nombre").toString()));

}

oList.setVector(vector);
for(int i=0;i<vector.size();i++){
myList.insert(i);
}
myList.setCallback(oList);
add(myList);
}

catch (Exception e) {
System.out.println("i am here in catch");
e.printStackTrace();

}
}


private class ListCallback implements ListFieldCallback {
// the listElements vector contain the entries in the list
private Vector listElements = new Vector();

public void drawListRow(ListField arg0, Graphics g, int index,
int y, int w) {
if(listElements.size()>index){
String text = (String)listElements.elementAt(index);
g.drawText(text, 0, y, 0, w);
}
}

public Object get(ListField list, int index) {
if(listElements.size()>index){
return listElements.elementAt(index);
}
return null;
}

public int getPreferredWidth(ListField arg0) {
// TODO Auto-generated method stub
return Graphics.getScreenWidth();
}

public int indexOfList(ListField arg0, String arg1, int arg2) {
// TODO Auto-generated method stub
return 0;
}

public void setVector(Vector v){
this.listElements = v;
}
public void insert(String toInsert, int index) {
listElements.addElement(toInsert);
}

}
}
}
Offline  
Old 07-18-2011, 04:14 AM   #75 (permalink)
New Member
 
Join Date: Jul 2011
Model: 9530
PIN: N/A
Carrier: AT&T
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

how did u solve this?
Offline  
Old 07-19-2011, 02:28 AM   #76 (permalink)
New Member
 
Join Date: Jul 2011
Model: 8600
PIN: N/A
Carrier: hutch
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

Where is this StockQuoteScreen?
Offline  
Old 07-22-2011, 06:09 AM   #77 (permalink)
New Member
 
Join Date: Jul 2011
Model: 9530
PIN: N/A
Carrier: AT&T
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

Quote:
Originally Posted by daquino473 View Post
Hello,


How did you solve the problem above?? could you help me
How did u solthis above problem mennal??
Offline  
Old 10-03-2011, 07:50 AM   #78 (permalink)
New Member
 
Join Date: Oct 2011
Model: 8520
PIN: N/A
Carrier: Idea
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

"Blackberry project dependencies" option is avaliable in JDE and not in eclipse.
Offline  
Old 12-23-2011, 03:05 AM   #79 (permalink)
New Member
 
Join Date: Dec 2011
Model: 9800
PIN: N/A
Carrier: bb developer
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

hi snicked

really the post is very helpful to all.

But i have one related issue as you have created all the ksoap packages to a jar in the same way i need to create a package (for example:components package) to jar what are the steps that i need to be followed.

if you help me out in this it would be greatful.

Thanks in advance
Offline  
Old 01-30-2012, 04:48 AM   #80 (permalink)
New Member
 
Join Date: Jan 2012
Model: 7100T
OS: Win XP
PIN: N/A
Carrier: Verizon
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

Hi, i am getting the following IOException Local connection timed out after ~ 120000
cud some1 tell me wat possibly is going wrong ???
Offline  




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