该文,主要记录作者在使用ksoap2-android库可以轻松实现对Webservice的访问时,关于包含于头部的认证信息的操作。
服务器端Webservice中GetSome接口:
…
public AuthHead authToken;
…
[WebMehtod]
[SoapHeader(“authToken”, Direction = SoapHeaderDirection.In)]
Public String GetSome(){
If(authToken == null){
return “the authToken is null”;
}
If(authToken.passWord != “***”){
return “the passWord is wrong”;
}
else{
return “Success”;
}
}
其中AuthHead:
public class AuthHead : SoapHeader{
public string passWord;
}
Webservice WSDL: