BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-29-2007, 04:47 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jan 2007
Location: India
Model: 7230
Carrier: Airtel(india)
Posts: 18
Post Thanks: 0
Thanked 0 Times in 0 Posts
Post Need help in Calling webservice using Ksoap

Please Login to Remove!

Hello all,
I am developing a standalone application for calling webservice from blackberry. I am using ksoap-1.2 and blackberry JDE 4.0.2. Webservice is written in .NET.
My webservice client code looks like this:

Object response=null;
HttpTransport ht = new HttpTransport("http://www.webservicex.net/country.asmx","\"http://www.webserviceX.NET/GetCurrencyByCountry\""); SoapObject request = new SoapObject("http://www.webservicex.net/","GetCurrencyByCountry");
request.addProperty("CountryName","india"); response=ht.call(request);
System.out.println("Webservice response " + response.toString())

I get the following exception:
soap falut-soap:Server faultstring: System.Web.Services.Protocols.SoapException:Server was unable
to process request--->System.Data.SqlClient.SqlException:Procedure or function getCurrencyByCountry expects
parameter '@name' which was not supplied at WebServicex.country.GetCurrencyByCountry(String CountryName)---
End of inner exception stack trace--'faultactor:'null' detaild:[EndTag </detail>]]

The exception tells that the required parameter is not passed.
But i am passing the parameter in the above code like this:

request.addProperty("CountryName","india");

u can also check the webservice in the path mentioned in above code

Any help regarding this will be appreciated.

thanks in advance.
Offline  
Old 05-29-2007, 06:15 AM   #2 (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

looks to me like your http request is completely seperate from the soap object. try something like this instead:

class testSoap extends Thread{

String url = "";
String serverResponse = "";

public void run() {
try {
SoapObject RPC = new SoapObject("http://webservices.mycompany.net/module", "webservicename");
RPC.addProperty("parameterName", "");
serverResponse = "" + new HttpTransport(url, "http://webservices.mycompany.net/module/webservicename").call(RPC);
}catch (SoapFault sf){

}catch(Exception e){

}
System.out.println("serverResponse = " + serverResponse);
}
__________________
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 05-29-2007, 07:35 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Jan 2007
Location: India
Model: 7230
Carrier: Airtel(india)
Posts: 18
Post Thanks: 0
Thanked 0 Times in 0 Posts
Post

hi jfisher,
the problem is not with the wrong http request.It is correct because i am able to hit the webservices.In the exception it clearly says that:
System.Data.SqlClient.SqlException:Procedure or function getCurrencyByCountry expects parameter '@name' which was not supplied at WebServicex.country.GetCurrencyByCountry(String CountryName)

SoapAction value i have taken from wsdl.so it is correct

i think i am passing parameter wrongly..do u have any other idea of passing the parameter.
Offline  
Old 05-29-2007, 07:48 AM   #4 (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

oh aye, missed the ht.call(request); cos there's no line break. your soap property looks fine so it may be an issue with the namespace, i'm assuming something weird happened when you pasted your code, this:

HttpTransport("http://www.webservicex.net/country.asmx","\"http://www.webserviceX.NET/GetCurrencyByCountry\"");

looks very wrong.
__________________
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 05-30-2007, 08:02 AM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Jan 2007
Location: India
Model: 7230
Carrier: Airtel(india)
Posts: 18
Post Thanks: 0
Thanked 0 Times in 0 Posts
Post

hi jfisher,

i am unable to pass the the paramter. i even tested by putting break point in my .net application and tried calling webservice.the request came there but with no parameter eventhough i am passing parameter like this in j2me client:

request.addProperty("parameter name","parameter value");

actually i am passing string value and returning boolean. so i dont need any SoapPrimitive object here because i am passing string.

so i am wrong in passing parameter.please help me to overcome this.
Suggest the correct way to pass the parameter.
Offline  
Old 06-05-2007, 10:42 AM   #6 (permalink)
New Member
 
Join Date: Jun 2007
Model: 8700
PIN: N/A
Carrier: ninguno
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

hello, im from argentina.
I'm new in BB development, I need a simple complete example to consume a web service from one BlackBerry with BB JDE 1.4...


Thank You

Luis Rogero
Offline  
Old 06-05-2007, 10:57 AM   #7 (permalink)
New Member
 
Join Date: Jun 2007
Model: 8700
PIN: N/A
Carrier: ninguno
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default consume a web service from one BlackBerry with BB JDE 1.4..

hello, im from argentina.
I'm new in BB development, I need a simple complete example as consume a web service from one BlackBerry with BB JDE 1.4...


Thank You

Luis Rogero
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





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