benkowik
benkowik

Reputation: 3

android ksoap and object in return

In my WebService, I have simple class:

public class UserName
    {
        public UserName() { }

        public UserName(string loginname, bool logged)
        {            
            this._loginname = loginname;            
            this._logged = logged;   
        }


        public string Loginname
        {
            set { this._loginname = value; }
            get { return this._loginname; }
        }

        public bool Logged
        {
            set { this._logged = value; }
            get { return this._logged; }
        }

        private string _loginname = string.Empty;
        private bool _logged = false;        
    }

I communication with my IIS (ADB Emulator):

SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);

SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);

HttpTransportSE transport= new HttpTransportSE(URL);

transport.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();

OK, this works fine.

I don't know how get UserName object in android code. How to make a response object class?

Upvotes: 0

Views: 1003

Answers (2)

pogo2065
pogo2065

Reputation: 314

I am actually working with one of these services right now, and this is what we were forced to do.

With the SOAP Service that I am workingo n, everything is returned as XML. You can use the following code to view the raw response from your service, and then decide what to do from there.

transport.responseDump

That String that is returned will give you the full response from the transport. You need to make sure that debugging is turned on first, this is done with the following.

transport.debug=true;

Upvotes: 1

Sagar Maiyad
Sagar Maiyad

Reputation: 12733

change your line:

SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();

to

SoapObject response=(SoapObject)envelope.bodyIn;

Upvotes: 0

Related Questions