Hey guys,
I try to build just a simple soap test its same as example from
farvale
http://vimeo.com/9633556
but what's the matter, it doesn't work for me ... ;(
I'm using eclipse 3.6.0 with latest add-in
coding for 1.5 -- testing on 1.5 virtual and real phone,
it basically should work with 1.5, too but there's a java class
missing...!?
mycode is not a huge thing:
( the problem is: request.addProperty("Celsius", "32"); )
------------------------------------------------------------
package com.linckhvt.soap;
import java.io.IOException;
import android.app.Activity;
import android.os.Bundle;
// import android.app.Activity;
// import android.os.Bundle;
import android.widget.TextView; /** for viewing text */
/** imports for soap */
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 org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;
public class Soap extends Activity {
/** Called when the activity is first created. */
private static final String SOAP_ACTION = "http://tempuri.org/
CelsiusToFahrenheit";
private static final String METHOD_NAME = "CelsiusToFahrenheit";
private static final String NAMESPACE = "http://tempuri.org/"; //
where xmlns=
private static final String URL = "http://www.w3schools.com/
webservices/tempconvert.asmx"; // where the service is
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView txt = new TextView(this);
txt.setText("Hello World - LIHE is here");
setContentView(txt);
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("Celsius", "32"); // ----heres the error
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
aht.call(SOAP_ACTION, envelope);
// HttpTransportSE androidHttpTransport = new
HttpTransportSE(URL);
// androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive resultString =
(SoapPrimitive)envelope.getResponse();
txt.setText(resultString.toString());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
------------------------------------------------------------
Error debug:
09-27 06:23:49.104: ERROR/dalvikvm(723): Could not find class
'java.awt.Frame', referenced from method
com.trend.iwss.jscan.runtime.Session.getContainingFrame
09-27 06:23:49.104: WARN/dalvikvm(723): VFY: unable to resolve
instanceof 68 (Ljava/awt/Frame;) in Lcom/trend/iwss/jscan/runtime/
Session;
09-27 06:23:49.104: WARN/dalvikvm(723): VFY: rejecting opcode 0x20 at
0x0004
09-27 06:23:49.104: WARN/dalvikvm(723): VFY: rejected Lcom/trend/iwss/
jscan/runtime/Session;.getContainingFrame (Ljava/awt/Container;)Ljava/
awt/Frame;
09-27 06:23:49.104: WARN/dalvikvm(723): Verifier rejected class Lcom/
trend/iwss/jscan/runtime/Session;
09-27 06:28:52.829: WARN/dalvikvm(723): Exception Ljava/lang/
VerifyError; thrown during Lorg/ksoap2/serialization/
PropertyInfo;.<clinit>
PLEASE help ....
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en