Hi Rajan,

If your are looking for hitting .net web service from android application,
you need to use an external jar file KSOAP2 at Android end.

       public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        final String NAMESPACE = "http://tempuri.org/";;
        final String METHOD_NAME = "Login";
        final String SOAP_ACTION = "http://tempuri.org/Login";;
        final String URL = "
http://ipaddressofwebserver/Dashboard/Service.asmx";;

        Button login = (Button)this.findViewById(R.id.btnLogin);



        login.setOnClickListener(new View.OnClickListener()
        {
 public void onClick(View arg0)
{
String [] data = {};
String x = " ";
         String username=null;
         String password=null;

EditText id = (EditText)findViewById(R.id.txt_username);
       EditText passkey = (EditText)findViewById(R.id.txt_password);

try {
         username=id.getText().toString();
         password=passkey.getText().toString();
         SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

               SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
               envelope.dotNet = true;
               request.addProperty("uname", username);
      request.addProperty("pass", password);
              envelope.setOutputSoapObject(request);

            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
            androidHttpTransport.call(SOAP_ACTION, envelope);
            SoapObject response = (SoapObject)envelope.getResponse();      //we
get soap object as response...
            data = getarray(response);

            x = data[0].toString();  //u can convert object to string also,
but i have passed array object in soap response



            if(data[0].toString().equalsIgnoreCase("true"))
                 {
              Toast.makeText(Login.this, "Login in
successful",Toast.LENGTH_LONG).show();
   }
           else
  {
Toast.makeText(Login.this, data[1].toString(),Toast.LENGTH_LONG).show();
  }

         }
  catch (Exception e)
        {
Toast.makeText(Login.this,"error",Toast.LENGTH_LONG).show();
}
}
});

}

 public static String[] getarray(SoapObject soap)
    {
        String[] categories = new String[soap.getPropertyCount()];
        for (int i = 0; i < categories.length; i++)
        {
        categories [i] = soap.getProperty(i).toString();
         }
        return categories;
    }

}






On Thu, Aug 16, 2012 at 8:09 PM, JP <joachim.pfeif...@gmail.com> wrote:

> This looks to me like you're trying to skin existing code over the Android
> platform?
> In my experience, DOM (tree parsing in general) isn't so great in the
> mobile environment as you have to load the tree structure up front to get
> to that last piece of data that you actually might be interested in.
> In an ideal world, you would probably want to break this down and
> implement the web services and SOAP elements on a web server. Your mobile
> app then queries this web server through small interactions. Using stream
> parsing and perhaps JSON in place of XML.
>
>
>
>
> On Thursday, August 16, 2012 3:46:32 PM UTC+2, Rajan wrote:
>>
>> i am trying to fetch the record from the SOAP web service but due to
>> larger xml size i didn't get the proper output,
>> here i'm putting my code as well as logcat entry.
>>
>>  --
> 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
>



-- 
-- 
.                 \\\///
.               /        \
.               | \\   // |
.             ( | (.) (.) |)
----------o00o--(_)--o00o-----------------

"Yesterday is not ours to recover, but
tomorrow is ours to win or to lose."

-----------ooo0-------------------------------
.           (   )   0ooo
.            \ (      (   )
.             \_)     ) /
.                    (_/

-- 
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