============ Problem Description ============
My Code
Soapobject request = new Soapobject (
"Http://webservices.home.whot.com", "Getvoteimgpath");
String namespace = "http://webservices.home.whot.com";
Element[] Header = new element[1];
Header[0] = new Element (). createelement (Namespace,
"Authenticationtoken");
Element userName = new Element (). createelement (namespace, "UserName");
Username.addchild (Node.text, "q1101876746");
Header[0].addchild (Node.element, userName);
//
Element pass = new Element (). createelement (namespace, "password");
Pass.addchild (Node.text, "252931024");
Header[0].addchild (node.element, pass);
Header[0].setattribute (namespace, "username", "q1101876746");
Header[0].setattribute (namespace, "password", "252931024");
<soap:header><authenticationtoken><username>abcd</username><password>34</ Password></authenticationtoken></soap:header>
Request.addproperty ("id", 163);
Soapserializationenvelope envelope = new Soapserializationenvelope (
SOAPENVELOPE.VER11);
Envelope.headerout = header;
Envelope.bodyout = Request;
Envelope.dotnet = true;
Envelope.setoutputsoapobject (Request);
Httptransportse ht = new Httptransportse (
"Http://test.rank365.cn/open/services/StartVotes");
Ht.debug = true;
try {
Long start = System.currenttimemillis ();
Ht.call (null, envelope);
Long timenum = System.currenttimemillis ()-Start;
LOG.I ("Soapservice", "Callservice Duration:" + timenum);
Object bodyin = Envelope.bodyin;
Object response = Envelope.getresponse ();
Object response = Envelope.bodyin;
if (response! = NULL) {
String str = Jsonutils.object2json (response);
System.out.println (str);
System.out.println (response.tostring () + "-------------");
System.out.println (Ht.requestdump);
System.out.println ("-----------------------------");
System.out.println (Ht.responsedump);
return response;
} else {
TODO Other case processing
}
} catch (Exception e) {
E.printstacktrace ();
System.out.println (Ht.requestdump);
if (handler! = null) {
Message msg = Handler.obtainmessage ();
Msg.what = constants.handler_what_exception;
Msg.obj = "Connection server connection exception";
Handler.sendmessage (msg);
}
}
return null;
============ Solution 1============
I've never been in touch, help you with the roof.
============ Solution 2============
Http://stackoverflow.com/questions/11179610/customization-of-ksoap2-android-envelope, the same problem as you.
Android Call WebService Send header authentication unsuccessful