how to use HttpTransportBasicAuth

711 views
Skip to first unread message

Rainer Klier

unread,
Mar 19, 2013, 11:45:31 AM3/19/13
to ksoap2-...@googlegroups.com
hi,

i have to use a webservice with basic authentication, and i found on http://code.google.com/p/ksoap2-android/wiki/CodingTipsAndTricks that for this purpose i should use HttpTransportBasicAuth from the "extra" package from ksoap2.

so i downloaded the ksoap2-extras-3.0.0.jar file and added it to the build path of my project.
after this, i was able to do the following in my webservice-code:

HttpTransportBasicAuth ahtBasicAuth = new HttpTransportBasicAuth(URL, "user", "password");

but what next?

how do i use it?

how should the HttpTransportBasicAuthbe used?

i didn't find any example.

can anyone tell my how to use it?

thanks in advance.

Qasim Azam

unread,
Mar 28, 2013, 5:24:08 AM3/28/13
to ksoap2-...@googlegroups.com
Can you send me the code, how can i send android form values to WCF ASP.net method.Please any help would be appreciated.

Qasim Azam

unread,
Mar 28, 2013, 5:24:41 AM3/28/13
to ksoap2-...@googlegroups.com
Using ksoap2. 

d...@nandgate.com

unread,
Apr 3, 2013, 9:32:00 AM4/3/13
to ksoap2-...@googlegroups.com
Hi Rainer,

I am unsure what you mean - are you just getting started with kSOAP? If so, try this tutorial (from the links, but not easy to find): http://seesharpgears.blogspot.com/2010/11/basic-ksoap-android-tutorial.html

You can substitute HttpTransportBasicAuth for HttpTransport if the web server expects authorization, the rest of the code should work for you.

I hope that helps.

Don.

Rainer Klier

unread,
Apr 10, 2013, 10:30:12 AM4/10/13
to ksoap2-...@googlegroups.com


Am Mittwoch, 3. April 2013 15:32:00 UTC+2 schrieb d...@nandgate.com:
Hi Rainer,

I am unsure what you mean - are you just getting started with kSOAP? If so, try this tutorial (from the links, but not easy to find): http://seesharpgears.blogspot.com/2010/11/basic-ksoap-android-tutorial.html

no, no, i am using ksoap2 for a long time.
but until now, i had to do only webservice calls without authentication.


You can substitute HttpTransportBasicAuth for HttpTransport if the web server expects authorization, the rest of the code should work for you.

when i use  HttpTransportBasicAuth, there are no methods i can call after i created the object.
with HttpTransportSE i can do:

HttpTransportSE aht = new HttpTransportSE(URL,timeout);
aht.call(SOAP_ACTION, soapEnvelope);

but, of course without authentication.
when i use
HttpTransportBasicAuth i can do:


HttpTransportBasicAuth ahtBasicAuth = new HttpTransportBasicAuth(URL, "user", "password");

but after this, i can't do aht.call() because there is no call method....


d...@nandgate.com

unread,
Apr 10, 2013, 11:40:59 AM4/10/13
to ksoap2-...@googlegroups.com
Then we are using different versions of kSOAP libraries... This is cut from my source code, with only the URL changed for security purposes:
   HttpTransportBasicAuth httpt = new HttpTransportBasicAuth(url, user, pass);
   
   httpt.debug = true;
   try {
       httpt.call("", envelope);

And it works. Hrrm... I did use some tricks from the old (pre-Android) kSOAP, wonder if that's the difference... My HttpTransportBasicAuth is copyright 2006, so that might be it.


But that means I have a working solution to help you... Does your HttpTransportBasicAuth (assuming you have source) extend HttpTransport? In my source the call routine is not over-ridden by HttpTransportBasicAuth, it just uses the HttpTransport.call(...) interface because the basic auth is handled in setup.

Don.
Reply all
Reply to author
Forward
0 new messages