Aller au contenu

consommation service web sous androide


Recommended Posts

slt je travaille sur un projet androide consistant à consommer un service web (rest/soap),depuis une application androide.le metier est hebergé sur un serveur d'application,l'application s'installe sans probleme mais une fois elle est lancée elle s'arrete soudainementen affichant le message suivant"unfortunatly monappl has stopped".vous trouvez ci joint l'activité principale ainsi que le fichier log generé par eclipse.merci pour votre aide.

package com.example.consowssoap;

import org.ksoap2.SoapEnvelope;

import org.ksoap2.serialization.SoapObject;

import org.ksoap2.serialization.SoapPrimitive;

import org.ksoap2.serialization.SoapSerializationEnvelope;

import org.ksoap2.transport.AndroidHttpTransport;

import android.net.ConnectivityManager;

import android.net.NetworkInfo;

import android.os.Bundle;

import android.app.Activity;

import android.content.Context;

import android.widget.TextView;

public class MainActivity extends Activity {

private static final String NAMESPACE ="http://tempuri.org/" ;

//private static final String NAMESPACE ="http://test.ws.com/" ;

private static final String URL="http://www.w3schools.com/webservices/tempconvert.asmx";

// private static final String URL="http://192.168.0.58:8080/wssopa/HellowService?wsdl";

private static final String SOAP_ACTION = "http://tempuri.org/CelsiusToFahrenheit";

//private static final String SOAP_ACTION = "http://test.ws.com/Hellow/sommeResponse";

private static final String METHOD_NAME = "CelsiusToFahrenheit";

//private static final String METHOD_NAME = "mult";

TextView tv;

private Object resultsRequestSOAP = null;

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

tv=(TextView)findViewById(R.id.textView2);

try

{

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

//request.addProperty("arg1",2);

//request.addProperty("arg2",2);

request.addProperty("Celsius",32);

SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

soapEnvelope.dotNet=true;

soapEnvelope.setOutputSoapObject(request);

AndroidHttpTransport aht = new AndroidHttpTransport(URL);

try

{

aht.call(SOAP_ACTION, soapEnvelope);

resultsRequestSOAP = soapEnvelope.getResponse();

// SoapPrimitive resultString=(SoapPrimitive)soapEnvelope.getResponse();

String[] resultString = (String[]) resultsRequestSOAP;

tv.setText("status :"+ resultString[0].toString());

}

catch(Exception e)

{

e.printStackTrace();

}

}

catch(Exception e)

{

tv.setText("Error : " + e.getMessage());

}

}

}

pour le fichier log

08-17 11:46:53.369: D/AndroidRuntime(599): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<

08-17 11:46:53.369: D/AndroidRuntime(599): CheckJNI is ON

08-17 11:46:54.449: D/AndroidRuntime(599): Calling main entry com.android.commands.pm.Pm

08-17 11:46:54.529: W/ActivityManager(78): No content provider found for permission revoke: file:///data/local/tmp/Consowssoap.apk

08-17 11:46:54.569: W/ActivityManager(78): No content provider found for permission revoke: file:///data/local/tmp/Consowssoap.apk

08-17 11:46:55.109: D/dalvikvm(78): GC_CONCURRENT freed 390K, 9% free 9168K/10055K, paused 8ms+38ms

08-17 11:46:55.259: I/PackageManager(78): Removing non-system package:com.example.consowssoap

08-17 11:46:55.259: I/ActivityManager(78): Force stopping package com.example.consowssoap uid=10043

08-17 11:46:55.259: I/Process(78): Sending signal. PID: 581 SIG: 9

08-17 11:46:55.389: W/InputManagerService(78): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@412bde60

08-17 11:46:55.719: I/PackageManager(78): Package com.example.consowssoap codePath changed from /data/app/com.example.consowssoap-2.apk to /data/app/com.example.consowssoap-1.apk; Retaining data and using new

08-17 11:46:55.719: I/PackageManager(78): Running dexopt on: com.example.consowssoap

08-17 11:46:56.819: D/dalvikvm(610): DexOpt: load 179ms, verify+opt 573ms

08-17 11:46:56.899: W/PackageManager(78): Code path for pkg : com.example.consowssoap changing from /data/app/com.example.consowssoap-2.apk to /data/app/com.example.consowssoap-1.apk

08-17 11:46:56.919: I/ActivityManager(78): Force stopping package com.example.consowssoap uid=10043

08-17 11:46:56.959: W/PackageManager(78): Resource path for pkg : com.example.consowssoap changing from /data/app/com.example.consowssoap-2.apk to /data/app/com.example.consowssoap-1.apk

08-17 11:46:57.269: D/PackageManager(78): New package installed in /data/app/com.example.consowssoap-1.apk

08-17 11:46:57.379: I/ActivityManager(78): Force stopping package com.example.consowssoap uid=10043

08-17 11:46:57.561: D/dalvikvm(189): GC_EXPLICIT freed 366K, 11% free 8570K/9543K, paused 10ms+20ms

08-17 11:46:57.739: D/dalvikvm(242): GC_EXPLICIT freed 221K, 5% free 7185K/7559K, paused 5ms+8ms

08-17 11:46:58.179: D/dalvikvm(78): GC_EXPLICIT freed 497K, 10% free 9109K/10055K, paused 21ms+14ms

08-17 11:46:58.249: D/PackageManager(78): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged

08-17 11:46:58.309: D/PackageManager(78): generateServicesMap(android.content.SyncAdapter): 4 services unchanged

08-17 11:46:58.319: D/BackupManagerService(78): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.example.consowssoap flg=0x10000010 (has extras) }

08-17 11:46:58.319: D/StrictMode(78): StrictMode policy violation; ~duration=52 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=151 violation=2

08-17 11:46:58.319: D/StrictMode(78): at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1074)

08-17 11:46:58.319: D/StrictMode(78): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1557)

08-17 11:46:58.319: D/StrictMode(78): at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1449)

08-17 11:46:58.319: D/StrictMode(78): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1405)

08-17 11:46:58.319: D/StrictMode(78): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1485)

08-17 11:46:58.319: D/StrictMode(78): at android.accounts.AccountManagerService.purgeOldGrants(AccountManagerService.java:224)

08-17 11:46:58.319: D/StrictMode(78): at android.accounts.AccountManagerService.access$000(AccountManagerService.java:76)

08-17 11:46:58.319: D/StrictMode(78): at android.accounts.AccountManagerService$1.onReceive(AccountManagerService.java:213)

08-17 11:46:58.319: D/StrictMode(78): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)

08-17 11:46:58.319: D/StrictMode(78): at android.os.Handler.handleCallback(Handler.java:605)

08-17 11:46:58.319: D/StrictMode(78): at android.os.Handler.dispatchMessage(Handler.java:92)

08-17 11:46:58.319: D/StrictMode(78): at android.os.Looper.loop(Looper.java:137)

08-17 11:46:58.319: D/StrictMode(78): at com.android.server.ServerThread.run(SystemServer.java:744)

08-17 11:46:58.359: I/AccountTypeManager(331): Loaded meta-data for 1 account types, 0 accounts in 27ms(wall) 9ms(cpu)

08-17 11:46:58.419: D/PackageManager(78): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged

08-17 11:46:58.439: D/PackageManager(78): generateServicesMap(android.content.SyncAdapter): 4 services unchanged

08-17 11:46:58.719: I/AccountTypeManager(331): Loaded meta-data for 1 account types, 0 accounts in 194ms(wall) 8ms(cpu)

08-17 11:46:58.740: D/BackupManagerService(78): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.consowssoap flg=0x10000010 (has extras) }

08-17 11:46:58.740: V/BackupManagerService(78): updatePackageParticipantsLocked: com.example.consowssoap

08-17 11:46:59.259: W/RecognitionManagerService(78): no available voice recognition services found

08-17 11:46:59.919: D/StrictMode(78): StrictMode policy violation; ~duration=634 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=151 violation=2

08-17 11:46:59.919: D/StrictMode(78): at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1074)

08-17 11:46:59.919: D/StrictMode(78): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:94)

08-17 11:46:59.919: D/StrictMode(78): at libcore.io.IoBridge.open(IoBridge.java:390)

08-17 11:46:59.919: D/StrictMode(78): at java.io.FileOutputStream.<init>(FileOutputStream.java:88)

08-17 11:46:59.919: D/StrictMode(78): at java.io.FileOutputStream.<init>(FileOutputStream.java:73)

08-17 11:46:59.919: D/StrictMode(78): at com.android.internal.os.AtomicFile.startWrite(AtomicFile.java:59)

08-17 11:46:59.919: D/StrictMode(78): at com.android.server.AppWidgetService.saveStateLocked(AppWidgetService.java:1181)

08-17 11:46:59.919: D/StrictMode(78): at com.android.server.AppWidgetService$2.onReceive(AppWidgetService.java:1452)

08-17 11:46:59.919: D/StrictMode(78): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)

08-17 11:46:59.919: D/StrictMode(78): at android.os.Handler.handleCallback(Handler.java:605)

08-17 11:46:59.919: D/StrictMode(78): at android.os.Handler.dispatchMessage(Handler.java:92)

08-17 11:46:59.919: D/StrictMode(78): at android.os.Looper.loop(Looper.java:137)

08-17 11:46:59.919: D/StrictMode(78): at com.android.server.ServerThread.run(SystemServer.java:744)

08-17 11:46:59.919: D/StrictMode(78): StrictMode policy violation; ~duration=605 ms: android.os.StrictMode$StrictModeDiskWriteViolation: policy=151 violation=1

08-17 11:46:59.919: D/StrictMode(78): at android.os.StrictMode$AndroidBlockGuardPolicy.onWriteToDisk(StrictMode.java:1048)

08-17 11:46:59.919: D/StrictMode(78): at libcore.io.BlockGuardOs.write(BlockGuardOs.java:178)

08-17 11:46:59.919: D/StrictMode(78): at libcore.io.IoBridge.write(IoBridge.java:447)

08-17 11:46:59.919: D/StrictMode(78): at java.io.FileOutputStream.write(FileOutputStream.java:187)

08-17 11:46:59.919: D/StrictMode(78): at com.android.internal.util.FastXmlSerializer.flushBytes(FastXmlSerializer.java:212)

08-17 11:46:59.919: D/StrictMode(78): at com.android.internal.util.FastXmlSerializer.flush(FastXmlSerializer.java:233)

08-17 11:46:59.919: D/StrictMode(78): at com.android.internal.util.FastXmlSerializer.endDocument(FastXmlSerializer.java:183)

08-17 11:46:59.919: D/StrictMode(78): at com.android.server.AppWidgetService.writeStateToFileLocked(AppWidgetService.java:1240)

08-17 11:46:59.919: D/StrictMode(78): at com.android.server.AppWidgetService.saveStateLocked(AppWidgetService.java:1182)

08-17 11:46:59.919: D/StrictMode(78): at com.android.server.AppWidgetService$2.onReceive(AppWidgetService.java:1452)

08-17 11:46:59.919: D/StrictMode(78): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)

08-17 11:46:59.919: D/StrictMode(78): at android.os.Handler.handleCallback(Handler.java:605)

08-17 11:46:59.919: D/StrictMode(78): at android.os.Handler.dispatchMessage(Handler.java:92)

08-17 11:46:59.919: D/StrictMode(78): at android.os.Looper.loop(Looper.java:137)

08-17 11:46:59.919: D/StrictMode(78): at com.android.server.ServerThread.run(SystemServer.java:744)

08-17 11:46:59.929: D/StrictMode(78): StrictMode policy violation; ~duration=599 ms: android.os.StrictMode$StrictModeDiskWriteViolation: policy=151 violation=1

08-17 11:46:59.929: D/StrictMode(78): at android.os.StrictMode$AndroidBlockGuardPolicy.onWriteToDisk(StrictMode.java:1048)

08-17 11:46:59.929: D/StrictMode(78): at libcore.io.BlockGuardOs.fsync(BlockGuardOs.java:84)

08-17 11:46:59.929: D/StrictMode(78): at java.io.FileDescriptor.sync(FileDescriptor.java:71)

08-17 11:46:59.929: D/StrictMode(78): at android.os.FileUtils.sync(FileUtils.java:111)

08-17 11:46:59.929: D/StrictMode(78): at com.android.internal.os.AtomicFile.finishWrite(AtomicFile.java:80)

08-17 11:46:59.929: D/StrictMode(78): at com.android.server.AppWidgetService.saveStateLocked(AppWidgetService.java:1183)

08-17 11:46:59.929: D/StrictMode(78): at com.android.server.AppWidgetService$2.onReceive(AppWidgetService.java:1452)

08-17 11:46:59.929: D/StrictMode(78): at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:728)

08-17 11:46:59.929: D/StrictMode(78): at android.os.Handler.handleCallback(Handler.java:605)

08-17 11:46:59.929: D/StrictMode(78): at android.os.Handler.dispatchMessage(Handler.java:92)

08-17 11:46:59.929: D/StrictMode(78): at android.os.Looper.loop(Looper.java:137)

08-17 11:46:59.929: D/StrictMode(78): at com.android.server.ServerThread.run(SystemServer.java:744)

08-17 11:46:59.929: D/BackupManagerService(78): Received broadcast Intent { act=android.intent.action.PACKAGE_REPLACED dat=package:com.example.consowssoap flg=0x10000010 (has extras) }

08-17 11:46:59.959: V/BackupManagerService(78): updatePackageParticipantsLocked: com.example.consowssoap

08-17 11:47:00.269: D/dalvikvm(78): GC_CONCURRENT freed 498K, 9% free 9185K/10055K, paused 6ms+15ms

08-17 11:47:01.339: D/dalvikvm(189): GC_FOR_ALLOC freed 541K, 12% free 8481K/9543K, paused 80ms

08-17 11:47:01.580: D/dalvikvm(189): GC_FOR_ALLOC freed 381K, 12% free 8472K/9543K, paused 74ms

08-17 11:47:01.769: D/dalvikvm(189): GC_CONCURRENT freed 5K, 7% free 8941K/9543K, paused 5ms+8ms

08-17 11:47:02.189: D/dalvikvm(78): GC_EXPLICIT freed 213K, 10% free 9076K/10055K, paused 7ms+28ms

08-17 11:47:02.239: D/AndroidRuntime(599): Shutting down VM

08-17 11:47:02.259: D/dalvikvm(599): GC_CONCURRENT freed 100K, 78% free 454K/2048K, paused 1ms+1ms

08-17 11:47:02.269: D/dalvikvm(599): Debugger has detached; object registry had 1 entries

08-17 11:47:02.289: I/AndroidRuntime(599): NOTE: attach of thread 'Binder Thread #3' failed

08-17 11:47:02.979: D/AndroidRuntime(619): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<

08-17 11:47:02.979: D/AndroidRuntime(619): CheckJNI is ON

08-17 11:47:04.109: D/AndroidRuntime(619): Calling main entry com.android.commands.am.Am

08-17 11:47:04.150: I/ActivityManager(78): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.consowssoap/.MainActivity} from pid 619

08-17 11:47:04.189: W/WindowManager(78): Failure taking screenshot for (120x180) to layer 21005

08-17 11:47:04.240: D/AndroidRuntime(619): Shutting down VM

08-17 11:47:04.279: D/dalvikvm(619): GC_CONCURRENT freed 101K, 77% free 483K/2048K, paused 1ms+14ms

08-17 11:47:04.279: D/jdwp(619): Got wake-up signal, bailing out of select

08-17 11:47:04.279: D/dalvikvm(619): Debugger has detached; object registry had 1 entries

08-17 11:47:04.289: I/AndroidRuntime(619): NOTE: attach of thread 'Binder Thread #3' failed

08-17 11:47:04.320: D/dalvikvm(630): Not late-enabling CheckJNI (already on)

08-17 11:47:04.349: I/ActivityManager(78): Start proc com.example.consowssoap for activity com.example.consowssoap/.MainActivity: pid=630 uid=10043 gids={3003}

08-17 11:47:04.399: I/WindowManager(78): createSurface Window{411c77b0 Starting com.example.consowssoap paused=false}: DRAW NOW PENDING

08-17 11:47:04.649: I/dalvikvm(630): Turning on JNI app bug workarounds for target SDK version 7...

08-17 11:47:04.709: W/NetworkManagementSocketTagger(78): setKernelCountSet(10043, 1) failed with errno -2

08-17 11:47:04.769: V/PhoneStatusBar(146): setLightsOn(true)

08-17 11:47:05.469: E/dalvikvm(630): Could not find class 'org.ksoap2.serialization.SoapObject', referenced from method com.example.consowssoap.MainActivity.onCreate

08-17 11:47:05.469: W/dalvikvm(630): VFY: unable to resolve new-instance 489 (Lorg/ksoap2/serialization/SoapObject;) in Lcom/example/consowssoap/MainActivity;

08-17 11:47:05.480: D/dalvikvm(630): VFY: replacing opcode 0x22 at 0x0012

08-17 11:47:05.499: D/dalvikvm(630): DexOpt: unable to opt direct call 0x0c26 at 0x18 in Lcom/example/consowssoap/MainActivity;.onCreate

08-17 11:47:05.499: D/dalvikvm(630): DexOpt: unable to opt direct call 0x0c28 at 0x2a in Lcom/example/consowssoap/MainActivity;.onCreate

08-17 11:47:05.499: D/dalvikvm(630): DexOpt: unable to opt direct call 0x0c2b at 0x37 in Lcom/example/consowssoap/MainActivity;.onCreate

08-17 11:47:05.669: D/AndroidRuntime(630): Shutting down VM

08-17 11:47:05.669: W/dalvikvm(630): threadid=1: thread exiting with uncaught exception (group=0x409961f8)

08-17 11:47:05.699: E/AndroidRuntime(630): FATAL EXCEPTION: main

08-17 11:47:05.699: E/AndroidRuntime(630): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject

08-17 11:47:05.699: E/AndroidRuntime(630): at com.example.consowssoap.MainActivity.onCreate(MainActivity.java:46)

08-17 11:47:05.699: E/AndroidRuntime(630): at android.app.Activity.performCreate(Activity.java:4465)

08-17 11:47:05.699: E/AndroidRuntime(630): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)

08-17 11:47:05.699: E/AndroidRuntime(630): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)

08-17 11:47:05.699: E/AndroidRuntime(630): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)

08-17 11:47:05.699: E/AndroidRuntime(630): at android.app.ActivityThread.access$600(ActivityThread.java:122)

08-17 11:47:05.699: E/AndroidRuntime(630): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)

08-17 11:47:05.699: E/AndroidRuntime(630): at android.os.Handler.dispatchMessage(Handler.java:99)

08-17 11:47:05.699: E/AndroidRuntime(630): at android.os.Looper.loop(Looper.java:137)

08-17 11:47:05.699: E/AndroidRuntime(630): at android.app.ActivityThread.main(ActivityThread.java:4340)

08-17 11:47:05.699: E/AndroidRuntime(630): at java.lang.reflect.Method.invokeNative(Native Method)

08-17 11:47:05.699: E/AndroidRuntime(630): at java.lang.reflect.Method.invoke(Method.java:511)

08-17 11:47:05.699: E/AndroidRuntime(630): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)

08-17 11:47:05.699: E/AndroidRuntime(630): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)

08-17 11:47:05.699: E/AndroidRuntime(630): at dalvik.system.NativeStart.main(Native Method)

08-17 11:47:05.710: W/ActivityManager(78): Force finishing activity com.example.consowssoap/.MainActivity

08-17 11:47:05.721: W/WindowManager(78): Failure taking screenshot for (120x180) to layer 21010

08-17 11:47:05.839: I/WindowManager(78): createSurface Window{41238810 paused=false}: DRAW NOW PENDING

08-17 11:47:06.230: W/NetworkManagementSocketTagger(78): setKernelCountSet(10005, 0) failed with errno -2

08-17 11:47:06.249: W/ActivityManager(78): Activity pause timeout for ActivityRecord{4122a2e0 com.example.consowssoap/.MainActivity}

08-17 11:47:06.259: W/NetworkManagementSocketTagger(78): setKernelCountSet(10005, 1) failed with errno -2

08-17 11:47:06.339: I/WindowManager(78): createSurface Window{41319870 com.android.launcher/com.android.launcher2.Launcher paused=false}: DRAW NOW PENDING

08-17 11:47:06.529: W/NetworkManagementSocketTagger(78): setKernelCountSet(10043, 0) failed with errno -2

08-17 11:47:16.579: W/ActivityManager(78): Activity destroy timeout for ActivityRecord{4122a2e0 com.example.consowssoap/.MainActivity}

Lien vers le commentaire
Partager sur d’autres sites

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

×
×
  • Créer...