Hi,

I am facing problem in calling my webservice InsertUserInformation
operation:

My webservice can be accessed using below URL:
https://www.enmapps.com/Services/MobileCloudService.svc?wsdl

MY MainActivity Class code is as follows:

package com.test.android;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
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.widget.*;
import android.util.Log;

public class MainActivity extends Activity {
    /** Called when the activity is first created. */
        private static final String NAMESPACE = "http://tempuri.org/";;
        private static final String URL =
                "https://www.enmapps.com/Services/MobileCloudService.svc";;
        private static final String SOAP_ACTION = "http://tempuri.org/
IMobileCloudService/";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
                setContentView(R.layout.main);
                InsertUserInformation();
                GetEmailIdOfUser();
        }

    private void InsertUserInformation() {
        Button toggleButton = (Button)findViewById(R.id.Button01);
        toggleButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
                String METHOD_NAME = "InsertUserInformation";

                UserInfo userInfo = new UserInfo();
                userInfo.NameIdentitifer="ni";
                userInfo.IdentityProvider="ip";

                SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
                PropertyInfo pi1 = new PropertyInfo();
                pi1.setName("userInfo");
                pi1.setType(userInfo.getClass());
                pi1.setValue(userInfo);
    //          pi1.setNamespace(NAMESPACE);
                request.addProperty(pi1);

                SoapSerializationEnvelope envelope =
                        new SoapSerializationEnvelope(SoapEnvelope.VER11);
                envelope.dotNet = true;
                envelope.setOutputSoapObject(request);
 
envelope.addMapping(request.getNamespace(),"userInfo",userInfo.getClass());
                AndroidHttpTransport androidHttpTransport =new
AndroidHttpTransport(URL);
                //HttpTransportSE androidHttpTransport = new
HttpTransportSE(URL);

                try {
                        //androidHttpTransport.call(SOAP_ACTION, envelope);
                        TrustManagerManipulator.allowAllSSL();
                        androidHttpTransport.call(SOAP_ACTION+METHOD_NAME, 
envelope);
                        SoapObject resultsRequestSOAP = (SoapObject)
envelope.getResponse();
                        if(resultsRequestSOAP!=null)
                        Log.i("Response:: ", resultsRequestSOAP.toString());

                } catch (Exception e) {
                        e.printStackTrace();
                }
        // TODO Auto-generated method stub
        }
        });
        }
}

Also, My UserInfo class code is as follows:

package com.test.android;

import java.util.Hashtable;
import org.ksoap2.serialization.KvmSerializable;
import org.ksoap2.serialization.PropertyInfo;

public class UserInfo implements KvmSerializable{
        public String AddressLine1="";
        public String BusinessPhoneNumber="";
        public String City="";
        public String CompanyName="";
        public String Country="";
        public String Email="";
        public String IdentityProvider="";
        public String NameIdentitifer="";
        public String PersonalPhoneNumber="";
        public String State="";
        public String StreetAddress="";
        public String UserName="";
        public String Version="";
        public String ZipCode="";

        public UserInfo(){}


   public UserInfo(String addressLine1, String businessPhoneNumber,
         String city,
         String companyName,
         String country,
         String email,
         String identityProvider,
         String nameIdentitifer,
         String personalPhoneNumber,
         String state,
         String streetAddress,
         String userName,
         String version,
         String zipCode) {

        AddressLine1 = addressLine1;
        BusinessPhoneNumber = businessPhoneNumber;
        City= city;
                CompanyName = companyName;
                Country = country;
                Email = email;
                IdentityProvider = identityProvider;
                NameIdentitifer = nameIdentitifer;
                PersonalPhoneNumber = personalPhoneNumber;
                State = state;
                StreetAddress = streetAddress;
                UserName = userName;
                Version = version;
                ZipCode = zipCode;
    }


        @Override
        public Object getProperty(int arg0) {
                // TODO Auto-generated method stub

                 switch(arg0) {
         case 0 :
             return AddressLine1;
         case 1 :
             return BusinessPhoneNumber;
         case 2 :
             return City;
         case 3 :
                 return CompanyName;
         case 4 :
                 return Country;
         case 5 :
                 return Email;
         case 6 :
                 return IdentityProvider;
         case 7 :
                 return NameIdentitifer;
         case 8 :
                 return PersonalPhoneNumber;
         case 9 :
                 return State;
         case 10 :
                 return StreetAddress;
         case 11 :
                 return UserName;
         case 12 :
                 return Version;
         case 13 :
                 return ZipCode;


     }
     return null;

        }
        @Override
        public int getPropertyCount() {
                // TODO Auto-generated method stub
                return 14;
        }
        @Override
        public void getPropertyInfo(int index, Hashtable arg1, PropertyInfo
info) {
                // TODO Auto-generated method stub
                switch(index) {
        case 0 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "AddressLine1";
            break;
        case 1 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "BusinessPhoneNumber";
            break;
        case 2 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "City";
            break;
        case 3 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "CompanyName";
            break;
        case 4 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "Country";
            break;
        case 5 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "Email";
            break;
        case 6 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "IdentityProvider";
            break;
        case 7 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "NameIdentitifer";
            break;
        case 8 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "PersonalPhoneNumber";
            break;
        case 9 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "State";
            break;
        case 10 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "StreetAddress";
            break;
        case 11 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "UserName";
            break;
        case 12 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "Version";
            break;
        case 13 :
            info.type = PropertyInfo.STRING_CLASS;
            info.name = "ZipCode";
            break;
        default :
            break;
    }

        }
        @Override
        public void setProperty(int index, Object value) {
                // TODO Auto-generated method stub
                 switch(index) {
         case 0 :
                 AddressLine1 = value.toString();
             break;
         case 1 :
                 BusinessPhoneNumber = value.toString();
             break;
         case 2 :
                 City = value.toString();
             break;
         case 3 :
                 CompanyName = value.toString();
             break;
         case 4 :
                 Country = value.toString();
             break;
         case 5 :
                 Email = value.toString();
             break;
         case 6 :
                 IdentityProvider = value.toString();
             break;
         case 7 :
                 NameIdentitifer = value.toString();
             break;
         case 8 :
                 PersonalPhoneNumber = value.toString();
             break;
         case 9 :
                 State = value.toString();
             break;
         case 10 :
                 StreetAddress = value.toString();
             break;
         case 11 :
                 UserName = value.toString();
             break;
         case 12 :
                 Version = value.toString();
             break;
         case 13 :
                 ZipCode = value.toString();
             break;

         default :
             break;
     }

        }
}

While trying to call my webservice InsertUserInformation operation I
am getting runtime exception as follows:

08-19 18:07:04.819: WARN/System.err(365): SoapFault - faultcode:
'a:DeserializationFailed' faultstring: 'The formatter threw an
exception while trying to deserialize the message: There was an error
while trying to deserialize parameter http://tempuri.org/:userInfo.
The InnerException message was 'Error in line 1 position 364. Element
'http://tempuri.org/:userInfo' contains data from a type that maps to
the name 'http://tempuri.org/:UserInfo'. The deserializer has no
knowledge of any type that maps to this name. Consider using a
DataContractResolver or add the type corresponding to 'UserInfo' to
the list of known types - for example, by using the KnownTypeAttribute
attribute or by adding it to the list of known types passed to
DataContractSerializer.'.  Please see InnerException for more
details.' faultactor: 'null' detail: org.kxml2.kdom.Node@44f28830

Please help me in resolving this issue.
Thanks


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to