[android-developers] Re: help needed on webservice (ksoap2)

2008-10-17 Thread shailesh prakash

It works fine on mine service using java, hope php has similar
implementation. See this may be error due to some semantic mistake.
also check for wsdl with the browser. Those are some mistake I have
done earlier. But I go with the original j2me jar. On that implement
extra classes of ksoap2-android-full-2.1.2(two class in transport
package), add commons-httpclient-3.1.jar.

Thread t = new Thread()
{
private static final String SOAP_ACTION 
= add;
private static final String METHOD_NAME 
= add;
private static final String NAMESPACE = 
http://wtp.mycomp.com;;
private static final String URL =
http://192.168.1.101:8080/Axis2ServiceServer/services/CalculatorService;;
Integer a = null;
Integer b = null;

@Override
public void run()
{
String stA = ((EditText)
findViewById(R.id.EditText01)).getText().toString();
String stB = ((EditText)
findViewById(R.id.EditText02)).getText().toString();
SoapSerializationEnvelope 
envelope = null;
try
{
a = 
Integer.valueOf(stA);
b = 
Integer.valueOf(stB);
SoapObject request = 
new SoapObject(NAMESPACE,METHOD_NAME);

request.addProperty(a, a);

request.addProperty(b, b);
envelope = new 
SoapSerializationEnvelope(SoapEnvelope.VER11);

envelope.setOutputSoapObject(request);
AndroidHttpTransport 
androidHttpTransport = new
AndroidHttpTransport(URL);

androidHttpTransport.call(SOAP_ACTION, envelope);
Object result = 
envelope.getResponse();
KSoapClient.res = 
result.toString();
}
catch (NumberFormatException 
nfe)
{
KSoapClient.res = Only 
Integer numbers ;
Log.e(Input Error: , 
nfe.getMessage());
}
catch (SoapFault sf)
{
Log.e(Service Response 
Error, + sf.faultcode+:,
sf.faultstring);
}
catch (IOException ioe)
{
Log.e(Service Response 
Error: , ioe.getMessage());
}
catch (XmlPullParserException 
xppe)
{
Log.e(Service Response 
Error: , xppe.getMessage());
}
}
};
t.start();
On Fri, Oct 17, 2008 at 8:57 PM, CJ [EMAIL PROTECTED] wrote:

 Hi, guys
 finally i gave up on trying it by myself. i am dying for help. plz
 thanks
 CJ

 my situation is pretty simple. i have a webservice set up using php
 under apache.

 i have ksoap2-android-full-2.1.2.jar imported in eclipse.

 on android client,
 i have  uses-permission android:name=android.permission.INTERNET /
  in the manifest file
 ?xml version=1.0 encoding=utf-8?
 manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=com.my.application.stupid.android
  android:versionCode=1
  android:versionName=1.0.0
uses-permission android:name=android.permission.INTERNET /
application android:icon=@drawable/icon android:label=@string/
 app_name
 ..

 in the code, i have
 String SOAP_ACTION = helloWorld;
String METHOD_NAME = sayhi;

[android-developers] Re: help needed on webservice (ksoap2)

2008-10-17 Thread CJ
in wireshark, i did not find any traffic sent out to the service
server. so, my guess is it did not get sent out at all.

On Oct 17, 12:05 pm, shailesh prakash [EMAIL PROTECTED] wrote:
 It works fine on mine service using java, hope php has similar
 implementation. See this may be error due to some semantic mistake.
 also check for wsdl with the browser. Those are some mistake I have
 done earlier. But I go with the original j2me jar. On that implement
 extra classes of ksoap2-android-full-2.1.2(two class in transport
 package), add commons-httpclient-3.1.jar.

 Thread t = new Thread()
                                 {
                                         private static final String 
 SOAP_ACTION = add;
                                         private static final String 
 METHOD_NAME = add;
                                         private static final String NAMESPACE 
 = http://wtp.mycomp.com;;
                                         private static final String URL =
 http://192.168.1.101:8080/Axis2ServiceServer/services/CalculatorService;;
                                         Integer a = null;
                                         Integer b = null;

                                         @Override
                                         public void run()
                                         {
                                                 String stA = ((EditText)
 findViewById(R.id.EditText01)).getText().toString();
                                                 String stB = ((EditText)
 findViewById(R.id.EditText02)).getText().toString();
                                                 SoapSerializationEnvelope 
 envelope = null;
                                                 try
                                                 {
                                                         a = 
 Integer.valueOf(stA);
                                                         b = 
 Integer.valueOf(stB);
                                                         SoapObject request = 
 new SoapObject(NAMESPACE,METHOD_NAME);
                                                         
 request.addProperty(a, a);
                                                         
 request.addProperty(b, b);
                                                         envelope = new 
 SoapSerializationEnvelope(SoapEnvelope.VER11);
                                                         
 envelope.setOutputSoapObject(request);
                                                         AndroidHttpTransport 
 androidHttpTransport = new
 AndroidHttpTransport(URL);
                                                         
 androidHttpTransport.call(SOAP_ACTION, envelope);
                                                         Object result = 
 envelope.getResponse();
                                                         KSoapClient.res = 
 result.toString();
                                                 }
                                                 catch (NumberFormatException 
 nfe)
                                                 {
                                                         KSoapClient.res = 
 Only Integer numbers ;
                                                         Log.e(Input Error: 
 , nfe.getMessage());
                                                 }
                                                 catch (SoapFault sf)
                                                 {
                                                         Log.e(Service 
 Response Error, + sf.faultcode+:,
 sf.faultstring);
                                                 }
                                                 catch (IOException ioe)
                                                 {
                                                         Log.e(Service 
 Response Error: , ioe.getMessage());
                                                 }
                                                 catch (XmlPullParserException 
 xppe)
                                                 {
                                                         Log.e(Service 
 Response Error: , xppe.getMessage());
                                                 }
                                         }
                                 };
                                 t.start();



 On Fri, Oct 17, 2008 at 8:57 PM, CJ [EMAIL PROTECTED] wrote:

  Hi, guys
  finally i gave up on trying it by myself. i amdyingfor help. plz
  thanks
  CJ

  my situation is pretty simple. i have a webservice set up using php
  under apache.

  i have ksoap2-android-full-2.1.2.jar imported in eclipse.

  on android client,
  i have  uses-permission android:name=android.permission.INTERNET /
       in the manifest file
  ?xml version=1.0 encoding=utf-8?
  manifest xmlns:android=http://schemas.android.com/apk/res/android;
       package=com.my.application.stupid.android
       android:versionCode=1
       android:versionName=1.0.0