false als result bei webservice

F

franzman5

Neues Mitglied
0
Hallo zusammen,

ich rufe mittels ksoap2 einen webservice auf, als ergebnis bekomme ich leider immer false zurück.

Hier der Code:
Code:
[SIZE=2][COLOR=#7f0055][B][SIZE=2][COLOR=#7f0055]package[/COLOR][/SIZE][/B]
[LEFT][/COLOR][/SIZE][SIZE=2]app.wetter;[/SIZE][/LEFT]
 

[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/COLOR][/SIZE][/B][/LEFT]
[SIZE=2][COLOR=#7f0055]
 
[LEFT][/COLOR][/SIZE][SIZE=2]android.app.Activity;[/SIZE]

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/COLOR][/SIZE][/B][/LEFT]
[SIZE=2][COLOR=#7f0055]
 
[LEFT][/COLOR][/SIZE][SIZE=2]android.os.Bundle;[/SIZE]

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/COLOR][/SIZE][/B][/LEFT]
[SIZE=2][COLOR=#7f0055]
 
[LEFT][/COLOR][/SIZE][SIZE=2]android.widget.TextView;[/SIZE][/LEFT]
 

[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/COLOR][/SIZE][/B][/LEFT]
[SIZE=2][COLOR=#7f0055]
 
[LEFT][/COLOR][/SIZE][SIZE=2]org.ksoap2.*;[/SIZE]

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/COLOR][/SIZE][/B][/LEFT]
[SIZE=2][COLOR=#7f0055]
 
[LEFT][/COLOR][/SIZE][SIZE=2]org.ksoap2.serialization.KvmSerializable;[/SIZE]

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/COLOR][/SIZE][/B][/LEFT]
[SIZE=2][COLOR=#7f0055]
 
[LEFT][/COLOR][/SIZE][SIZE=2]org.ksoap2.serialization.SoapObject;[/SIZE]

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/COLOR][/SIZE][/B][/LEFT]
[SIZE=2][COLOR=#7f0055]
 
[LEFT][/COLOR][/SIZE][SIZE=2]org.ksoap2.serialization.SoapPrimitive;[/SIZE]

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/COLOR][/SIZE][/B][/LEFT]
[SIZE=2][COLOR=#7f0055]
 
[LEFT][/COLOR][/SIZE][SIZE=2]org.ksoap2.serialization.SoapSerializationEnvelope;[/SIZE]

[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/COLOR][/SIZE][/B][/LEFT]
[SIZE=2][COLOR=#7f0055]
 
[LEFT][/COLOR][/SIZE][SIZE=2]org.ksoap2.transport.AndroidHttpTransport;[/SIZE][/LEFT]
 

[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][/LEFT]
[SIZE=2][COLOR=#7f0055]
 
[LEFT][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Wetter [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]extends[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] Activity {[/SIZE][/LEFT]
 

[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] String [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]SOAP_ACTION[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http://www.webservicex.net/GetWeather"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] String [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]METHOD_NAME[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"GetWeather"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] String [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]NAMESPACE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http://www.webserviceX.NET"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]static[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]final[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] String [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]URL[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2] = [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"http://www.webservicex.net/globalweather.asmx"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE][/LEFT]
[/LEFT]

 

[LEFT][SIZE=2]TextView [/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]tv[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE][/LEFT]

 

[LEFT][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]/**[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]Called[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]when[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]the[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]activity[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]is[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]first[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]created.[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#3f5fbf][SIZE=2][COLOR=#3f5fbf]*/[/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][SIZE=2][COLOR=#646464][SIZE=2][COLOR=#646464]@Override[/COLOR][/SIZE][/COLOR][/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/COLOR][/SIZE][/B][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]void[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] onCreate(Bundle savedInstanceState) {[/SIZE]
[B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]super[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2].onCreate(savedInstanceState);[/SIZE]
[SIZE=2]setContentView(R.layout.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]main[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]tv[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = (TextView) findViewById(R.id.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]TextView01[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE][/LEFT]
[/LEFT]

 

[LEFT][SIZE=2]SoapObject Request = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] SoapObject([/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]NAMESPACE[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], [/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]METHOD_NAME[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[LEFT][SIZE=2]Request.addProperty([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"CityName"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Munich"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2]Request.addProperty([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"CountryName"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2], [/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]""[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE][/LEFT]
[/LEFT]

 

[LEFT][SIZE=2]SoapSerializationEnvelope soapEnvelope = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] SoapSerializationEnvelope([/SIZE]
[LEFT][SIZE=2]SoapEnvelope.[/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]VER12[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE]
[SIZE=2]soapEnvelope.[/SIZE][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]dotNet[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]true[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2];[/SIZE]
[SIZE=2]soapEnvelope.setOutputSoapObject(Request);[/SIZE][/LEFT]
[/LEFT]

 

[LEFT][SIZE=2]AndroidHttpTransport aht = [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] AndroidHttpTransport([/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]URL[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2]);[/SIZE][/LEFT]

 
 
 

[LEFT][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]try[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] {[/SIZE]
[LEFT][SIZE=2]aht.call([/SIZE][I][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]SOAP_ACTION[/COLOR][/SIZE][/COLOR][/SIZE][/I][SIZE=2], soapEnvelope);[/SIZE]
[SIZE=2]SoapObject resultString = (SoapObject) soapEnvelope.getResponse();[/SIZE][/LEFT]
[/LEFT]

 

[LEFT][SIZE=2]SoapObject result = (SoapObject) resultString.getProperty(0); [/SIZE][SIZE=2][COLOR=#3f7f5f][SIZE=2][COLOR=#3f7f5f]// [/COLOR][/SIZE][/COLOR][/SIZE]
[LEFT][SIZE=2]SoapPrimitive text = (SoapPrimitive) result.getProperty([/SIZE][/LEFT]
[/LEFT]

 
[LEFT][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Temperature"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE][/LEFT]
 
 

[LEFT][SIZE=2][COLOR=#0000c0][SIZE=2][COLOR=#0000c0]tv[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].setText([/SIZE][SIZE=2][COLOR=#2a00ff][SIZE=2][COLOR=#2a00ff]"Status: "[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] + text.toString());[/SIZE][/LEFT]

 

[LEFT][SIZE=2]} [/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]catch[/COLOR][/SIZE][/COLOR][/SIZE][/B][SIZE=2] (Exception e) {[/SIZE][/LEFT]

 

[LEFT][SIZE=2]e.printStackTrace();[/SIZE][/LEFT]

 

[LEFT][SIZE=2]}[/SIZE][/LEFT]

 

[LEFT][SIZE=2]}[/SIZE]
[LEFT][SIZE=2]}[/SIZE][/LEFT]
[/LEFT]

Wenn ich mit soapUI den Webservice teste funktioniert es.​

hat jemand ne idee?​

danke und schönen Gruß​
 

Ähnliche Themen

R
  • raller
Antworten
15
Aufrufe
505
DOT2010
DOT2010
D
Antworten
17
Aufrufe
322
datNeMo
D
S
Antworten
4
Aufrufe
956
Sempervivum
S
Zurück
Oben Unten