BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-29-2007, 06:09 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: T-Mobile
Posts: 18
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default NullPointerException with ksoap2

Please Login to Remove!

hello again,

i try to call a web service from my BB-simulator using ksoap2. i use following code:

Code:
SoapObject client = new SoapObject("urn:namespace","Method_name"); 
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
client.addProperty("Parameter_name","String_value");

HttpTransport ht = new HttpTransport("http://www.mydomain.de/web_service_name.asmx");
ht.call("urn:namespace",envelope);
System.out.println(envelope.getResponse().toString());
i get a NullPointerException at ht.call(...)
and have no idea why?

please help!
Offline  
Old 11-29-2007, 08:32 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: T-Mobile
Posts: 18
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

obviously i'm doing something wrong, but i don't get it...
can somebody please post the code to call this little example webservice:

currconvert

that would help me alot. thx
Offline  
Old 11-30-2007, 02:52 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: T-Mobile
Posts: 18
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

can somebody please help me?

i'm really stuck with this problem.
Offline  
Old 11-30-2007, 06:59 PM   #4 (permalink)
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I hope you're not actually passing in values such as "Parameter_name".

Here's a snippet that works with webservicex (not the dotnet "ugly hack" here).

Code:
SoapObject request = new SoapObject("http://www.webserviceX.NET", "GetCountryByCountryCode");
request.addProperty("CountryCode", "US");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransport ht = new HttpTransport("http://www.webservicex.net/country.asmx");
ht.call("http://www.webserviceX.NET/GetCountryByCountryCode", envelope); 
add(new RichTextField("Response: " + envelope.getResponse()));
Offline  
Old 12-03-2007, 03:46 AM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2007
Model: 8800
PIN: N/A
Carrier: T-Mobile
Posts: 18
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you very much, richard.

finally i can call my .net web service.

btw: no, i didn't used the values i posted earlier, lol.
Offline  




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