使用KSOAP在Android中请求具有对象数组(complextype)

时间:2012-03-21 11:32:05

标签: android request ksoap

我有这个网络服务:

<message name="getListOB3Request">
<part name="user" type="xsd:string"/>
<part name="pass" type="xsd:string"/>
<part name="server" type="xsd:string"/>
<part name="tableName" type="xsd:string"/>
<part name="fields" type="tns:ArrayOfFieldOB"/>
<part name="sql" type="xsd:string"/>
</message>

FieldOB数组是:

<xsd:complexType name="ArrayOfFieldOB">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="FieldOB[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>

和FieldOB是:

<xsd:complexType name="FieldOB">
<xsd:all>
<xsd:element name="St_field" type="xsd:string"/>
</xsd:all>
</xsd:complexType>

我有一个实现kvmSerializable

的OBField类
public class OBField implements Serializable, KvmSerializable
{
  ...
}

和一个实现kvmSerializable

的ArrayOBField类
public class OBArrayListSerializable extends ArrayList<OBField> implements Serializable, KvmSerializable
{
  ....
public void getPropertyInfo(int index, Hashtable arg1, PropertyInfo propertyInfo)
    {
        // TODO Auto-generated method stub
        switch (index)
        {
            case 0:
            {
                propertyInfo.name = "ArrayOfFieldOB";
                propertyInfo.type = new OBField().getClass();
                break;
            }
        }
    }
    }

网络服务电话:

  envelope.addMapping(NAMESPACE, "fields", new OBArrayListSerializable().getClass());

  HttpTransportSE androidHttpTransport = new HttpTransportSE(URL_GENERAL+url);

  try
   {
        androidHttpTransport.call(SOAP_ACTION_GENERAL+metodo, envelope);
        SoapObject response (SoapObject)envelope.bodyIn;
   }

这是我的请求(envelope.bodyOut)

getListOB3{user=myUser; pass=myPass; 
    server=http://localhost/test; 
    tableName=BusinessPartner; 
    fields=[com.androidTest.ws.OBField@44e8c988, com.androidTest.ws.OBField@44e8ca20]; 
    sql=; }

问题出在“字段”中,这是一个OBField数组。

似乎网络服务无法正确接收“字段”

感谢

0 个答案:

没有答案