ksoap setProperity is not working in android

37 visualizzazioni
Passa al primo messaggio da leggere

Amira El Sayed

da leggere,
1 apr 2017, 11:27:5801/04/17
a ksoap2-android

I am building an app that consume .asmx web service

I am facing a strange problem , all parameters that I sent with the request is null in the server

This is my method

try {

                    SoapObject request = new SoapObject(DealightsConstants.NAMESPACE, DealightsConstants.METHOD_MOBILE_LOGIN);
                    //request.addProperty(DealightsConstants.METHOD_MOBILE_LOGIN_USERNAME, username);
                    //request.addProperty(DealightsConstants.METHOD_MOBILE_LOGIN_PASSWORD, password);
                    PropertyInfo pi = new PropertyInfo();
                    pi.setName(DealightsConstants.METHOD_MOBILE_LOGIN_USERNAME);
                    pi.setValue(username);
                    pi.setType(String.class);

                    PropertyInfo pi1 = new PropertyInfo();
                    pi1.setName(DealightsConstants.METHOD_MOBILE_LOGIN_PASSWORD);
                    pi1.setValue(password);
                    pi1.setType(String.class);

                    request.addProperty(pi);
                    request.addProperty(pi1);

                    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                    envelope.dotNet=true;
                    envelope.setOutputSoapObject(request);

                    HttpTransportSE androidHttpTransport = new HttpTransportSE(DealightsConstants.URL);
                    androidHttpTransport.call(DealightsConstants.SOAP_ACTION + DealightsConstants.METHOD_MOBILE_LOGIN, envelope);
                    androidHttpTransport.debug=true;

                    Object result = envelope.getResponse();
                    if (result != null) {

                        Log.i("AMIRA" , result.toString());
                        JSONArray array = new JSONArray(result.toString());
                        if (array != null && array.length() > 0) {
                            return array.getJSONObject(0);
                        } else {
                            return null;
                        }
                    } else {
                        return null;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    return null;
                }

I have use a lot of formats and nothing work with me






Rispondi a tutti
Rispondi all'autore
Inoltra
0 nuovi messaggi