BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-02-2007, 04:01 PM   #1 (permalink)
New Member
 
Join Date: Oct 2007
Location: Alberta Canada
Model: 8830
PIN: N/A
Carrier: Bell
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Web Service problem in JRE

Please Login to Remove!

I'm trying to connect to a web service in JRE. The sample code that I'm using is found at Simplified Technology Solutions, Inc - Articles - BlackBerry Web Services Intro.

The sample uses HttpConnection.Get to send the values to the web service. I've tried everything I can think of an cannot get the code to work. Is there anyone that has a working sample that I can use it JRE?

I tried using MDS and there was no problem getting the service to work from there so I know the web service is OK.
Offline  
Old 11-05-2007, 03:23 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

i work with webservices using ksoap2 and can absolutely suggest it. All you need to do is to open a transport, rest is done by the framework.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 11-05-2007, 06:44 AM   #3 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

another angle on this, if ksoap feels like too much of an overhead is to create a simple http post class - all soap needs is a http post with a string of xml. after a couple of years using ksoap i moved to my own class and it's much more lightweight.

i can't share the code but my starting point was to capture the packets from a working web service implementation using smartsniff and then used that as a basis to build my own class where you just pass the xml and webmethod name - it's a reusable class thats only 1k in size.
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Old 11-05-2007, 10:13 AM   #4 (permalink)
New Member
 
Join Date: Oct 2007
Location: Alberta Canada
Model: 8830
PIN: N/A
Carrier: Bell
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default try KSoap2

I will give ksoap2 a try. The only reason I was trying it with the httpConnection.Get method was because I could get an example project to learn the syntax. I'll search for an example with ksoap2.
Offline  
Old 11-07-2007, 11:14 AM   #5 (permalink)
New Member
 
Join Date: Oct 2007
Location: Alberta Canada
Model: 8830
PIN: N/A
Carrier: Bell
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've been trying the ksoap2 and connot get the api to preverify and as a result I haven't got anything to work. Do you have an example of how to use an http POST command to send the XML? Right now JDE is so new that I need some code to follow.
Offline  
Old 11-07-2007, 11:28 AM   #6 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

i have attached a verified jar-file of the ksoap library. It is slightly modified as we have fixed a bug within SoapFault.java

here is an example how to use ksoap:

Code:
	public String login(String mandant, String username, String password, String pin, String mailaddress) throws Exception {
		SoapObject soapObject = getSoapObject("login");
		soapObject.addProperty("arg0", mandant);
		soapObject.addProperty("arg1", username);
		soapObject.addProperty("arg2", password);
		soapObject.addProperty("arg3", pin);
		soapObject.addProperty("arg4", mailaddress);
		
		SoapSerializationEnvelope envelope = getEnvelope(soapObject);
        transport.call("urn:anonOutInOp", envelope);

        String response = envelope.getResponse().toString();
        
        return response;
	}
Attached Files
File Type: zip ksoap.zip (46.0 KB, 15 views)
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 11-07-2007, 11:36 AM   #7 (permalink)
New Member
 
Join Date: Oct 2007
Location: Alberta Canada
Model: 8830
PIN: N/A
Carrier: Bell
Posts: 9
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks so much. This is exactly what I needed. Your a lifesaver.
Offline  
Old 11-09-2007, 05:09 PM   #8 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2007
Model: 8800
PIN: N/A
Carrier: o2
Posts: 38
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am usign web services, but do so via a proxy that I have developed.

I simply post a dilimeted string to the server (no xml), and get back a delimited string, which I interpret. The client<-> server protocol is very simple, with a requestid, and a list of parameters.

Its a simple solution, but works great. In fact its so simple, that many people I know think its stupid !!

I plan on writing a code generator, which will read a WSDL, and generate the server and client portions of code that will fit in this framework, when I need to add new method calls.
Offline  




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