Hi
I use the ksoap webservice to PHP server from android. I can get
string responses in android,
but have problem with complex types.
PHP code
----------------
$server->wsdl->addComplexType(
'arrayreturn',
'complexType',
'struct',
'all',
'',
array( 'name' => 'xsd:string', 'type' => 'xsd:string')
);
$server->register('get_login',
array('username' => 'xsd:string','password' => 'xsd:string'), //
input parameters
array('response' => 'xsd:arrayreturn'),
// output parameter
'$ns:get_login',
// namespace
"$ns:get_login#get_login",
// soapaction
'rpc',
// style
'encoded',
// use
'check username and password'
// documentation
);
ANDROID code
-----------------------
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("username",userfield.getText().toString() );
request.addProperty("password",passwrdfield.getText().toString() );
SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
resultsRequestSOAP = (SoapObject) envelope.getResponse();
//String[] resultData =
(String[])resultsRequestSOAP.getProperty("response");
//Toast.makeText(getBaseContext(),resultData.length,
Toast.LENGTH_SHORT).show();
for(int i=0;i<resultsRequestSOAP.getPropertyCount();i++)
{
SoapObject contObj=(SoapObject)resultsRequestSOAP.getProperty(i);
Toast.makeText(getBaseContext(),contObj.toString(),
Toast.LENGTH_SHORT).show();
//resultsRequestSOAP.this.ContList.addElement(new
SCODContact(contObj));
}
}
catch (Exception e){
Toast.makeText(getBaseContext(),""+e,Toast.LENGTH_SHORT).show();
}
--------------------------------------------------------------------------
am getting exception while using complex type. please help me on
this.
Thanks
Veradis
--
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