Hi I used the ksoap library from tuxpan and the tutorial of here
http://chitgoks.blogspot.com/2008/03/android-and-web-services.html
Normal string returntypes are going BUT i have a problem with complex
types of soap varaibles.

I have set up a coldfusion webserver. which has the following test
webservice.

--------------------
Code:

<cfcomponent>

  <cffunction name="getMessage" access="remote" returntype="any"
output="no">

        <cfargument name="vname" type="string" required="yes">
        <cfargument name="nname" type="string" required="yes">

                <cfset ArrayAppend(response, arguments.vname)>
                <cfset ArrayAppend(response, arguments.nname)>

        <cfset response = structnew()>
        <cfset response.vname = arguments.vname>
        <cfset response.nname = arguments.nname>
        <cfreturn response>

  </cffunction>

</cfcomponent>
---------

THE PROBLEM is that normal strings are comming threw but when I'm
setting a complex type to this i can't get the attributes themselve
What i get is the whole object as a string with the object.toString()
method..

I looked to cast the object to a string Array Object but then a
castexexption comes from Java

Next i tried this Android Client app with vectors but here they say
illegal argument.

------------
Code:

import java.util.Vector;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.AndroidHttpTransport;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.TextView;

public class test_ws_array extends Activity {
        private static final String SOAP_ACTION = "getMessage";
    private static final String METHOD_NAME = "getMessage";
    private static final String NAMESPACE = "http://
rpc.xml.coldfusion";
    // !!!!! WICHTIG !!!!! IMMER NEUE IP EINTRAGEN DA SICH DIESE
JEDESMAL AENDERT !!!!!
    private static final String URL = "http://195.30.48.80:8500/DA/
ws_functions/test4.cfc?wsdl";
    //private static final String URL = "http://192.168.1.33:8500/DA/
ws_functions/test.cfc?wsdl";


    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.main);


                //Buttons deaktiviert alles automatisch

        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
                request.addProperty("vname", "Christian");
                request.addProperty("nname", "Braun");

        SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.setOutputSoapObject(request);
        AndroidHttpTransport androidHttpTransport = new
AndroidHttpTransport (URL);
        try {
                androidHttpTransport.call(SOAP_ACTION, envelope);

                SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
                Vector XXXX = (Vector)
resultsRequestSOAP.getProperty("[VNAME]");
                //Vector XXXX = (Vector) resultsRequestSOAP.getProperty(0);


                //Object result =  envelope.getResponse();
                //Object result = new Object();
                //result =  envelope.getResponse();

                //Object[] results = (Object[]) result;
                //2 Zeilen weg die sollten gehen mit Komplexen Objekttypen)
            //String[] str = (String[]) result;
            //
((TextView)findViewById(R.id.lblStatus)).setText(resultsRequestSOAP.toString());
 
((TextView)findViewById(R.id.lblStatus)).setText(XXXX.toString());

            //
((TextView)findViewById(R.id.lblStatus)).setText(result.toString());
        } catch(Exception E) {
                ((TextView)findViewById(R.id.lblStatus)).setText("ERROR:" +
E.getClass().getName() + ": " + E.getMessage());
        }
    }
}
------------

When i make a output with toString() method with the result then this
is displayed on the screen:

getMessageResponse{getMessagereturn=Map{item=anyType{key=VNAME;value=Christian;};
item=anyType{key=NNAME; value=Braun;};};}

Maybe you can help me - this would be very helpful

Have you tried a complex Soap Type in a different way? And maybe have
a sample app? Thanx!

Christian
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to