BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 10-04-2010, 06:13 AM   #61
nada
New Member
 
Join Date: Oct 2010
Model: 7100t
PIN: N/A
Carrier: system developer
Posts: 1
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
grp1260
New Member
 
Join Date: Oct 2010
Model: 7100T
PIN: N/A
Carrier: test
Posts: 1
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
NDN_84
New Member
 
Join Date: Nov 2010
Model: 7100T
PIN: N/A
Carrier: developer
Posts: 1
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
pchristensen
New Member
 
Join Date: Nov 2010
Model: 9700
PIN: N/A
Carrier: t-mobile
Posts: 2
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
pchristensen
New Member
 
Join Date: Nov 2010
Model: 9700
PIN: N/A
Carrier: t-mobile
Posts: 2
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
go4voip
New Member
 
Join Date: Nov 2010
Model: 7100T
PIN: N/A
Carrier: AT&T
Posts: 7
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
daquino473
New Member
 
Join Date: Nov 2010
Model: 9630
PIN: N/A
Carrier: IUSACELL
Posts: 1
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
avidalg
New Member
 
Join Date: Dec 2010
Model: 8300
PIN: N/A
Carrier: Entel
Posts: 1
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
Tapina
New Member
 
Join Date: Mar 2011
Model: 8950
PIN: N/A
Carrier: US Cellular
Posts: 1
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
kennkra
New Member
 
Join Date: Apr 2011
Model: 7100t
PIN: N/A
Carrier: Telefonica
Posts: 1
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

i have the same problem as tapina.
Offline  
Old 05-18-2011, 06:02 PM   #71
mumuspace
New Member
 
Join Date: May 2011
Model: 7100T
PIN: N/A
Carrier: Rogers
Posts: 1
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
svshar
New Member
 
Join Date: May 2011
Model: 7100
PIN: N/A
Carrier: Google
Posts: 1
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
firstbbapp
New Member
 
Join Date: Jun 2011
Model: 9900
PIN: N/A
Carrier: IT (development)
Posts: 1
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
cuteguys
New Member
 
Join Date: Jul 2011
Model: 9530
PIN: N/A
Carrier: AT&T
Posts: 3
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
cuteguys
New Member
 
Join Date: Jul 2011
Model: 9530
PIN: N/A
Carrier: AT&T
Posts: 3
Default Re: **** BlackBerry and Ksoap2 Tutorial *****

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

Where is this StockQuoteScreen?
Offline  
Old 07-22-2011, 06:09 AM   #77
cuteguys
New Member
 
Join Date: Jul 2011
Model: 9530
PIN: N/A
Carrier: AT&T
Posts: 3
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
ranjeetwagh
New Member
 
Join Date: Oct 2011
Model: 8520
PIN: N/A
Carrier: Idea
Posts: 1
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
cyndrilla
New Member
 
Join Date: Dec 2011
Model: 9800
PIN: N/A
Carrier: bb developer
Posts: 1
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
sushantsahu
New Member
 
Join Date: Jan 2012
Model: 7100T
OS: Win XP
PIN: N/A
Carrier: Verizon
Posts: 2
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  
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


Audio Impedance Tester Portable CATIII Test Ranges 20/200/2000 Resistance Meter picture

Audio Impedance Tester Portable CATIII Test Ranges 20/200/2000 Resistance Meter

$84.99



Fluke  845AR High Impedance Voltmeter-Null Detector picture

Fluke 845AR High Impedance Voltmeter-Null Detector

$500.00



IMPEDENCE MATCHING TRANSFOMER BNC F-BNC F, 50 OHM TO 75 OHM, 20-1100 MHZ picture

IMPEDENCE MATCHING TRANSFOMER BNC F-BNC F, 50 OHM TO 75 OHM, 20-1100 MHZ

$28.00



Tenma 72-6947 Audio Impedance Tester picture

Tenma 72-6947 Audio Impedance Tester

$99.50



Digital Ohmmeter LCD Audio Impedance Test Meter Speaker Voice Resistor System picture

Digital Ohmmeter LCD Audio Impedance Test Meter Speaker Voice Resistor System

$88.00



WPI ISOMIL Optically isolated high-impedence millivoltmeter picture

WPI ISOMIL Optically isolated high-impedence millivoltmeter

$199.00







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