WEB开发网
开发学院手机开发Android 开发 Android利用ksoap传递复杂对象参数 阅读

Android利用ksoap传递复杂对象参数

 2012-12-19 14:27:32 来源:WEB开发网   
核心提示:writer.endTag(dataContract, "Age");writer.startTag(dataContract, "Name");writer.text(user.getName());writer.endTag(dataContract, "Name&
writer.endTag(dataContract, "Age");
writer.startTag(dataContract, "Name");
writer.text(user.getName());
writer.endTag(dataContract, "Name");
}

}

3 调用wcf,并定义complex type的内容如下:
SoapObject request = new SoapObject(serviceNameSpace, methodName);

User user = new User();
user.setAge(10);
user.setName("corning");

PropertyInfo pi = new PropertyInfo();
pi.setName("user");
pi.setValue(user);
pi.setType(user.getClass());
request.addProperty(pi);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

envelope.dotNet = true;
envelope.bodyOut = request;
envelope.implicitTypes = true;

envelope.addMapping(serviceNameSpace, User.UserClass.getSimpleName(), User.UserClass);

MarshalUser userMarshal = new MarshalUser();
userMarshal.register(envelope);
// Android传输对象
HttpTransportSE transport = new HttpTransportSE(serviceURL);
transport.debug = true;

上一页  1 2 

Tags:Android 利用 ksoap

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接