I have the following code using the Ksoap2-android-3.6.0 library
@Override
protected Void doInBackground(String... params) {
try {
SoapObject request = new SoapObject(NAME_SPACE, METHOD);
PropertyInfo propertyAutentica = new PropertyInfo();
Autentica autenticacion = new Autentica();
autenticacion.setLogin("mi clave");
autenticacion.setPassword("mi password");
propertyAutentica.setName("Autenticacion");
propertyAutentica.setValue(autenticacion);
propertyAutentica.setType(Autentica .class);
request.addPropertyIfValue(propertyAutentica);
// Modelo el Sobre
SoapSerializationEnvelope envp = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envp.dotNet = true;
envp.implicitTypes = false;
envp.setOutputSoapObject(request);
// Modelo el transporte
HttpTransportSE transporte = new HttpTransportSE(url,30000);
transporte.debug = true;
Log.d("Resultado", "request :: "+transporte.requestDump);
// Llamada
transporte.getServiceConnection().connect();
transporte.call(accionSoap, envp);
// Resultado
SoapObject resultado = (SoapObject) envp.getResponse();
Log.d("Resultado", resultado.toString());
} catch (XmlPullParserException e) {
Log.d("Resultado", e.toString());
} catch (HttpResponseException e) {
Log.d("Resultado", e.toString());
} catch (SoapFault soapFault) {
Log.d("Resultado", soapFault.toString());
} catch (IOException e) {
Log.d("Resultado", e.toString());
}
return null;
}
Authentication Class
public class ItemAutenticacion implements KvmSerializable {
private String Login;
private String Password;
public String getLogin() {
return Login;
}
public void setLogin(String login) {
Login = login;
}
public String getPassword() {
return Password;
}
public void setPassword(String password) {
Password = password;
}
@Override
public Object getProperty(int i) {
switch(i)
{
case 0:
return Login;
case 1:
return Password;
}
return null;
}
@Override
public int getPropertyCount() {
return 2;
}
@Override
public void getPropertyInfo(int i, Hashtable hashtable, PropertyInfo propertyInfo) {
switch(i)
{
case 0:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name = "Login";
break;
case 1:
propertyInfo.type = PropertyInfo.STRING_CLASS;
propertyInfo.name = "Password";
break;
}
}
@Override
public void setProperty(int i, Object o) {
switch (i){
case 0:
Login = o.toString();
break;
case 1:
Password = o.toString();
break;
}
}
}
The web service is made in Visual Basic and the problem I have is that my type authenticates me as null or Nothing and the log of
Log.d ("Result", "request ::" + transport.requestDump);
Returns to me
D / Result: request :: null
What do I need to add to send the data in the request?