android调用带soapheader的webservice

huazai 发布于 2012/08/16 10:43
阅读 1K+
收藏 0
android调用带soapheader的webservice
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
Element[] header = new Element[1];
header[0] = new Element().createElement(NameSpace, "header");
Element username = new Element().createElement(NameSpace,
"Username");
username.addChild(Node.TEXT, "admin");
header[0].addChild(Node.ELEMENT, username);
Element pass = new Element().createElement(NameSpace, "Password");
pass.addChild(Node.TEXT, "123");
header[0].addChild(Node.ELEMENT, pass);

envelope.headerOut = header;
// 设置是否调用的是dotNet下的WebService
envelope.dotNet = true;
// 必须,等价于envelope.bodyOut = request;
envelope.setOutputSoapObject(request);
// step4 创建HttpTransportSE对象
AndroidHttpTransport ht = new AndroidHttpTransport(this.finalUrl);
关键代码不对那 webservice那边

Element token = context.getInMessage().getHeader().getChild(
WebserviceConstant.TOKEN);
接受到的空值啊 请问高手给看看
加载中
返回顶部
顶部