FWIW I've tried using ksoap2 with wcf and it works until you get to
complex classes and then it falls over on the namespaces. The best bet
(if you can) is enable JSON on WCF and use GSON.

Cheers,

Ed

On Mar 19, 4:03 am, "g...@deanblakely.com" <g...@deanblakely.com>
wrote:
> I'm trying to see if it is feasible to access .Net WCF SOAP services
> from an android client.  I found a post at
>
> http://naveenbalani.com/index.php/2011/01/invoke-webservices-from-and...
>
> That shows how to accomplish this using a library named Ksoap2. I'm
> pretty sure I followed all of the instructions however I end up with
> the following error:
>
> "java.net.UnknownHostException: naveenbalani.com"
>
> Any Idea what might be wrong?
>
> a jpg of my run config is athttp://dl.dropbox.com/u/39662979/run
> config.jpg
> a zip of the project is 
> athttp://dl.dropbox.com/u/39662979/AndroidClientService.zip
>
> The source code is pasted below along with the console log (much of
> which I don't  understand)
>
> thanks,
> Gary Blakely
>
> package org.android.webservice.client.samples;
>
> import org.ksoap2.SoapEnvelope;
> import org.ksoap2.serialization.SoapObject;
> import org.ksoap2.serialization.SoapSerializationEnvelope;
> import org.ksoap2.transport.HttpTransportSE;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.widget.TextView;
>
> public class AndroidClientService extends Activity {
>
> private static final String SOAP_ACTION = "http://www.naveenbalani.com/
> webservices/WassupAndroidService/todaysMessage";
>
> private static final String OPERATION_NAME = "todaysMessage";
>
> private static final String WSDL_TARGET_NAMESPACE = 
> "http://www.naveenbalani.com/webservices/WassupAndroidService/";;
>
> private static final String SOAP_ADDRESS = "http://naveenbalani.com/
> WassupAndroid.asmx";
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
>
> TextView textView = new TextView(this);
>
> setContentView(textView);
>
> SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,
> OPERATION_NAME);
>
> SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
> SoapEnvelope.VER11);
> envelope.dotNet = true;
>
> envelope.setOutputSoapObject(request);
>
> HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
>
> try
>
> {
>
> httpTransport.call(SOAP_ACTION, envelope);
>
> Object response = envelope.getResponse();
>
> textView.setText(response.toString());
>
> }
>
> catch (Exception exception)
>
> {
>
> textView.setText(exception.toString());
>
> }
> }
> }
>
> [2012-03-18 10:45:41 - AndroidClientService] Dx warning: Ignoring
> InnerClasses attribute for an anonymous inner class
> (org.ksoap2.transport.KeepAliveHttpsTransportSE$1) that doesn't come
> with an
> associated EnclosingMethod attribute. This class was probably produced
> by a
> compiler that did not target the modern .class file format. The
> recommended
> solution is to recompile the class from source, using an up-to-date
> compiler
> and without specifying any "-target" type options. The consequence of
> ignoring
> this warning is that reflective operations on this class will
> incorrectly
> indicate that it is *not* an inner class.
> [2012-03-18 10:45:45 - AndroidClientService]
> ------------------------------
> [2012-03-18 10:45:45 - AndroidClientService] Android Launch!
> [2012-03-18 10:45:45 - AndroidClientService] adb is running normally.
> [2012-03-18 10:45:45 - AndroidClientService] Performing
> org.android.webservice.client.samples.AndroidClientService activity
> launch
> [2012-03-18 10:45:45 - AndroidClientService] Automatic Target Mode:
> Preferred AVD '233_avd' is not available. Launching new emulator.
> [2012-03-18 10:45:45 - AndroidClientService] Launching a new emulator
> with Virtual Device '233_avd'
> [2012-03-18 10:45:48 - Emulator] DNS server name 'ns15.unitechost.in'
> resolved to 69.10.57.50:55
> [2012-03-18 10:45:51 - Emulator] emulator: WARNING: Unable to create
> sensors port: Unknown error
> [2012-03-18 10:45:51 - AndroidClientService] New emulator found:
> emulator-5554
> [2012-03-18 10:45:51 - AndroidClientService] Waiting for HOME
> ('android.process.acore') to be launched...
> [2012-03-18 10:46:35 - AndroidClientService] HOME is up on device
> 'emulator-5554'
> [2012-03-18 10:46:35 - AndroidClientService] Uploading
> AndroidClientService.apk onto device 'emulator-5554'
> [2012-03-18 10:46:35 - AndroidClientService] Installing
> AndroidClientService.apk...
> [2012-03-18 10:46:53 - AndroidClientService] Success!
> [2012-03-18 10:46:53 - AndroidClientService] Starting activity
> org.android.webservice.client.samples.AndroidClientService on device
> emulator-5554
> [2012-03-18 10:46:55 - AndroidClientService] ActivityManager:
> Starting: Intent { act=android.intent.action.MAIN
> cat=[android.intent.category.LAUNCHER]
> cmp=org.android.webservice.client.samples/.AndroidClientService }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to