每次我上传一个新对象时,它都会向数据库提交一个空对象并忽略我为其设置的所有参数。
这是安卓端:
public void createGroupServ(String groupName)
{
request = new SoapObject(NAMESPACE, "createGroup");
Group gr = new Group();
gr.setGroupId(1L);
gr.setGroupName("xxxx");
gr.setUsers(null);
PropertyInfo object = new PropertyInfo();
object.setName("arg0");
object.setValue(gr);
object.setType(gr.getClass());
request.addProperty(object);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = false;
envelope.setOutputSoapObject(request);
envelope.addMapping(NAMESPACE, "group", new Group().getClass());
androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
}
和域类组:
public class Group implements KvmSerializable {
private long groupId;
private String groupName;
private List<User> users = null;
...setter and getters ...
}
我的 WSDL xml:
<xs:complexType name="group">
<xs:sequence>
<xs:element name="groupId" type="xs:long"/>
<xs:element name="groupName" type="xs:string" minOccurs="0"/>
<xs:element name="users" type="tns:user" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="createGroup">
<xs:sequence>
<xs:element name="arg0" type="tns:group" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
关于为什么不使用组名参数上传整个对象的任何建议?